3.2.4.2.48.47 CreateNotificationAction (Opnum 57)

The CreateNotificationAction method creates a notification and associates it with the specified notification period.

 [id(FSRM_DISPID_FILE_MANAGEMENT_JOB | 0x07)] HRESULT CreateNotificationAction(
   [in] long days,
   [in] FsrmActionType actionType,
   [out, retval] IFsrmAction** action
 );

days: The days parameter contains the notification period for which to create the action.

actionType: The actionType parameter contains the type of notification being created.

action: Pointer to an IFsrmAction interface pointer (section 3.2.4.2.4) that upon completion points to the newly created action. A caller MUST release the SAFEARRAY received when the caller is done with it.

Return Values: The method MUST return zero on success, or a nonzero error code on failure.

Return value/code

Description

0x80045301

FSRM_E_NOT_FOUND

The specified notification could not be found.

0x80045303

FSRM_E_ ALREADY_EXISTS

The object already exists.

0x80070057

E_INVALIDARG

This code is returned for the following reasons:

  • The days parameter is not a valid value; it is less than zero.

  • The actionType parameter is not a valid value. If actionType is FsrmActionType_Unknown, the parameter MUST be considered an invalid value.

  • The action parameter is NULL.

Upon receiving this message, the server MUST validate parameters:

  • Verify that days parameter is greater than or equal to 0.

  • Verify that actionType is a valid FsrmActionType (section 2.2.1.2.9) value. If actionType is FsrmActionType_Unknown or FsrmActionType_Report, the parameter MUST be considered an invalid value.

  • Verify that action is not NULL.

If any validation fails, the server MUST terminate processing and return a nonzero error code.

The server MUST perform the following steps in sequence or return a nonzero error code as follows:

  • Find the Notification period, if any, in the file management job's list of notification periods whose Notification Interval is equivalent to days. For the remainder of these steps, this will be referred to as the affected notification period.

  • If there is no affected notification period, the server MUST return FSRM_E_NOT_FOUND.

  • If there is an affected notification period, and one of its Notification period.Notifications has an Event type that is equivalent to actionType, the server MUST return FSRM_E_AlREADY_EXISTS.

  • Create a new notification object and set its parameters as follows:

    • Set Notification.Id to a GUID.

    • Set Run limit interval to -1.

    • Set Action type to actionType.

    • Set Last run time to a specific value in the past.<79> This value MUST be the same for all new notifications. Any value subsequently assigned to the property that is on or before this specific value MUST be interpreted by the server as "never".

    • If actionType is FsrmActionType_EventLog, the following parameters MUST be set:

      • Set Event type to Information.

      • Set Message text to an empty string.

    • If actionType is FsrmActionType_Email:

      • Set Mail from to the Mail from email address.

      • Set Mail subject to an empty string.

      • Set Mail reply to an empty string.

      • Set Mail cc to an empty string.

      • Set Mail bcc to an empty string.

      • Set Message text to an empty string.

    • If actionType is FsrmActionType_Command:

      • Set Executable path to an empty string.

      • Set Notification.Model.Arguments to an empty string.

      • Set Notification.Model.Account to a LocalService.

      • Set Working directory to an empty string.

      • Set Monitor command to false.

      • Set Kill time-out to -1.

      • Set Log result to false.

    • Add the new Notification object to the affected notification period's Notification period.Notifications.

    • Assign the new Notification object to the action parameter.