<div class="content"><p>The CreateNotificationAction method creates a <b>notification</b>
and associates it with the specified <b>notification period</b>.</p><dl>
<dd>
<div><pre> [id(FSRM_DISPID_FILE_MANAGEMENT_JOB | 0x07)] HRESULT CreateNotificationAction(
   [in] long days,
   [in] FsrmActionType actionType,
   [out, retval] IFsrmAction** action
 );
</pre></div>
</dd></dl><p><b>days: </b>The <i>days</i> parameter contains the <b>notification
period</b> for which to create the <b>action</b>.</p><p><b>actionType: </b>The <i>actionType</i> parameter
contains the type of <b>notification</b> being created.</p><p><b>action: </b>Pointer to an <b>IFsrmAction</b>
interface pointer (section <a href="8e93ed78-6809-4ee1-a98b-f3dcdc41ae71" data-linktype="relative-path">3.2.4.2.4</a>)
that upon completion points to the newly created action. A caller MUST release
the <a href="../ms-oaut/2e87a537-9305-41c6-a88b-b79809b3703a" data-linktype="relative-path">SAFEARRAY</a>
received when the caller is done with it.</p><p><b>Return Values: </b>The method MUST return zero on
success, or a nonzero error code on failure.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0x80045301</p>
  <p>FSRM_E_NOT_FOUND</p>
  </td>
  <td>
  <p>The specified notification could not be found.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80045303</p>
  <p>FSRM_E_ ALREADY_EXISTS</p>
  </td>
  <td>
  <p>The object already exists.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80070057</p>
  <p>E_INVALIDARG</p>
  </td>
  <td>
  <p>This code is returned for the following reasons:</p>
  <ul><li><p><span><span>  
  </span></span><span>The days parameter is not a valid
  value; it is less than zero.</span></p>
  </li><li><p><span><span>  
  </span></span><span>The <i>actionType</i> parameter
  is not a valid value. If <i>actionType</i> is <b>FsrmActionType_Unknown</b>,
  the parameter MUST be considered an invalid value.</span></p>
  </li><li><p><span><span>  
  </span></span><span>The action parameter is NULL.</span></p>
  </li></ul></td>
 </tr></tbody></table>
</dd></dl><p>Upon receiving this message, the server MUST validate
parameters:</p><ul><li><p><span><span> 
</span></span>Verify that <i>days</i> parameter is greater than or equal to 0.</p>
</li><li><p><span><span> 
</span></span>Verify that <i>actionType</i> is a valid <a href="0399ffcc-f04b-4dd9-bde7-c336e58eb8d4" data-linktype="relative-path">FsrmActionType (section 2.2.1.2.9)</a>
value. If <i>actionType</i> is <b>FsrmActionType_Unknown</b> or <b>FsrmActionType_Report</b>,
the parameter MUST be considered an invalid value.</p>
</li><li><p><span><span> 
</span></span>Verify that <i>action</i> is not NULL.</p>
</li></ul><p>If any validation fails, the server MUST terminate
processing and return a nonzero error code.</p><p>The server MUST perform the following steps in sequence or
return a nonzero error code as follows:</p><ul><li><p><span><span> 
</span></span>Find the <b>Notification period</b>, if any, in the file
management job&#39;s list of <b>notification periods</b> whose <b>Notification
Interval</b> is equivalent to <i>days</i>. For the remainder of these steps,
this will be referred to as the <b>affected notification period</b>.</p>
</li><li><p><span><span> 
</span></span>If there is no affected notification period, the server MUST
return FSRM_E_NOT_FOUND.</p>
</li><li><p><span><span> 
</span></span>If there is an affected notification period, and one of its <b>Notification
period.Notifications</b> has an <b>Event type</b> that is equivalent to <i>actionType</i>,
the server MUST return FSRM_E_AlREADY_EXISTS.</p>
</li><li><p><span><span> 
</span></span>Create a new notification object and set its parameters as
follows:</p>
<ul><li><p><span><span>  </span></span>Set
<b>Notification.Id</b> to a <a href="809180e0-571e-40a0-8067-ffe89cbdcc40#gt_f49694cc-c350-462d-ab8e-816f0103c6c1" data-linktype="relative-path">GUID</a>.</p>
</li><li><p><span><span>  </span></span>Set
<b>Run limit interval</b> to -1.</p>
</li><li><p><span><span>  </span></span>Set
<b>Action type</b> to <i>actionType</i>.</p>
</li><li><p><span><span>  </span></span>Set
<b>Last run time</b> to a specific value in the past.<a id="Appendix_A_Target_79"></a><a aria-label="Product behavior note 79" href="1cc8408c-3c9b-4510-9585-e4a8d0d40e27#Appendix_A_79" data-linktype="relative-path">&lt;79&gt;</a> 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
&#34;never&#34;.</p>
</li><li><p><span><span>  </span></span>If <i>actionType</i>
is <b>FsrmActionType_EventLog</b>, the following parameters MUST be set:</p>
<ul><li><p><span><span> 
</span></span>Set <b>Event type</b> to Information.</p>
</li><li><p><span><span> 
</span></span>Set <b>Message text</b> to an empty string.</p>
</li></ul></li><li><p><span><span>  </span></span>If <i>actionType</i>
is <b>FsrmActionType_Email:</b></p>
<ul><li><p><span><span> 
</span></span>Set <b>Mail from</b> to the <b>Mail from email address</b>.</p>
</li><li><p><span><span> 
</span></span>Set <b>Mail subject</b> to an empty string.</p>
</li><li><p><span><span> 
</span></span>Set <b>Mail reply</b> to an empty string.</p>
</li><li><p><span><span> 
</span></span>Set <b>Mail cc</b> to an empty string.</p>
</li><li><p><span><span> 
</span></span>Set <b>Mail bcc</b> to an empty string.</p>
</li><li><p><span><span> 
</span></span>Set <b>Message text</b> to an empty string.</p>
</li></ul></li><li><p><span><span>  </span></span>If <i>actionType</i>
is <b>FsrmActionType_Command:</b></p>
<ul><li><p><span><span> 
</span></span>Set <b>Executable path</b> to an empty string.</p>
</li><li><p><span><span> 
</span></span>Set <b>Notification.Model.Arguments</b> to an empty string.</p>
</li><li><p><span><span> 
</span></span>Set <b>Notification.Model.Account</b> to a LocalService.</p>
</li><li><p><span><span> 
</span></span>Set <b>Working directory</b> to an empty string.</p>
</li><li><p><span><span> 
</span></span>Set <b>Monitor command</b> to false.</p>
</li><li><p><span><span> 
</span></span>Set <b>Kill time-out</b> to -1.</p>
</li><li><p><span><span> 
</span></span>Set <b>Log result</b> to false.</p>
</li></ul></li><li><p><span><span>  </span></span>Add
the new Notification object to the affected notification period&#39;s <b>Notification
period.Notifications</b>.</p>
</li><li><p><span><span>  </span></span>Assign
the new Notification object to the <i>action</i> parameter.</p>
</li></ul></li></ul></div>