<div class="content" name="CreateScheduleTask" uuid="1ecf3605-59e3-4012-9df9-ac1f64e9c304"><p>The CreateScheduleTask method creates a task that is capable
of triggering the generation of a File Server Resource Manager Protocol <a href="809180e0-571e-40a0-8067-ffe89cbdcc40#gt_15957e50-08ab-48d2-8824-57a71b23f833" data-linktype="relative-path">report job</a>.</p><dl>
<dd>
<div><pre> [id(FSRM_DISPID_REPORT_SCHEDULER | 0x02)] HRESULT CreateScheduleTask(
   [in] BSTR taskName,
   [in] VARIANT* namespacesSafeArray,
   [in] BSTR serializedTask
 );
</pre></div>
</dd></dl><p><b>taskName: </b>Contains the name of the Task
Scheduler task to create.</p><p><b>namespacesSafeArray: </b>Pointer to a variable
that contains a <a href="../ms-oaut/a6a540af-38ac-48be-bd40-92e2c01e9aa6" data-linktype="relative-path">VARIANT</a>
structure, which contains a <a href="../ms-oaut/04e72b3f-5731-4508-9bb4-de29fbd0f781" data-linktype="relative-path">SAFEARRAY</a>
of VARIANT structures. The VARIANT structures contained in the SAFEARRAY MUST
be <a href="../ms-dtyp/692a42a9-06ce-4394-b9bc-5d2a50440168" data-linktype="relative-path">BSTR</a>
string values, each representing a local directory path that needs to be
verified as supported by the File Server Resource Manager Protocol storage.</p><p><b>serializedTask: </b>Contains the XML
representation of the task to be created.<a id="Appendix_A_Target_63"></a><a aria-label="Product behavior note 63" href="1cc8408c-3c9b-4510-9585-e4a8d0d40e27#Appendix_A_63" data-linktype="relative-path">&lt;63&gt;</a></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>0x80045303 FSRM_E_ALREADY_EXISTS</td>
  <td>The object already exists.</td>
 </tr><tr>
  <td>0x80045311 FSRM_E_NOT_SUPPORTED</td>
  <td>This function is not supported for this object.</td>
 </tr><tr>
  <td>0x80045316 FSRM_E_UNEXPECTED</td>
  <td>An unexpected error occurred; check the application event log. You might get this error if the XML is malformed.</td>
 </tr><tr>
  <td>0x80070057 E_INVALIDARG</td>
  <td>This code is returned for the following reasons:  The taskName parameter is NULL.  The namespacesSafeArray parameter is NULL.  The serializedTask parameter is NULL.</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>taskName</i> is not NULL.</p>
</li><li><p><span><span> 
</span></span>Verify that <i>namespacesSafeArray</i> is not NULL.</p>
</li><li><p><span><span> 
</span></span>Verify that <i>serializedTask</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 create the specified task in such a way that
it is capable of triggering the File Server Resource Manager Protocol report
jobs.</p></div>