<div class="content" name="CreateReport" uuid="37fae130-cb21-4783-91ac-9f9456a95b06"><p>The CreateReport method adds a report of the specified type
to a <a href="809180e0-571e-40a0-8067-ffe89cbdcc40#gt_15957e50-08ab-48d2-8824-57a71b23f833" data-linktype="relative-path">report job</a> object.</p><dl>
<dd>
<div><pre> [id(FSRM_DISPID_REPORT_JOB | 0x02)] HRESULT CreateReport(
   [in] FsrmReportType reportType,
   [out, retval] IFsrmReport** report
 );
</pre></div>
</dd></dl><p><b>reportType: </b>An <a href="84ba80a4-a6c5-41a1-9a8e-7c379e780772" data-linktype="relative-path">FsrmReportType (section 2.2.1.2.10)</a>
enumeration value that identifies the type of report contained in the <i>report</i>
parameter.</p><p><b>report: </b>A pointer to an <b>IFsrmReport</b>
interface pointer (section <a href="27464fd6-a52d-4450-99af-e01b940243f8" data-linktype="relative-path">3.2.4.2.35</a>)
that upon completion contains a pointer to the newly created report of the
specified type. The caller MUST release the report job when it 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>0x80045332 FSRM_E_REPORT_TYPE_ALREADY_EXISTS</td>
  <td>A report of the specified type already exists for the report job.</td>
 </tr><tr>
  <td>0x80070057 E_INVALIDARG</td>
  <td>The reportType parameter is not a valid value. If reportType is FsrmReportType_AutomaticClassification or FsrmReportType_Expiration, the parameter MUST be considered invalid. &lt;61&gt;</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>report</i> is not NULL.</p>
</li><li><p><span><span> 
</span></span>Verify that <i>reportType</i> contains a valid FsrmReportType
value. If the <i>reportType</i> is <b>FsrmReportType_Unknown</b>, <b>FsrmReportType_AutomaticClassification</b>
or <b>FsrmReportType_Expiration</b>, the parameter MUST be considered an
invalid value. Otherwise, all other FsrmReportType values SHOULD be considered
valid.<a id="Appendix_A_Target_62"></a><a aria-label="Product behavior note 62" href="1cc8408c-3c9b-4510-9585-e4a8d0d40e27#Appendix_A_62" data-linktype="relative-path">&lt;62&gt;</a></p>
</li></ul><p>If any validation fails, the server MUST terminate
processing and return a nonzero error code.</p><p>The server MUST set the <i>report</i> parameter to the <b>IFsrmReport</b>
interface of the newly created report based on the <i>reportType</i> specified
and add it to the <b>Report Job.Reports</b> element of the <a href="0b493832-f781-4c1a-bddd-d39c9df1680f" data-linktype="relative-path">Non-Persisted Report Job Instance (section 3.2.1.5.1.2)</a>
or return a nonzero error code.</p><p>In the <i>report</i> parameter, the server MUST set:</p><ul><li><p><span><span> 
</span></span>The <b>Report.Type</b> to the <i>reportType</i> parameter
specified.</p>
</li><li><p><span><span> 
</span></span>The report <b>Name</b> to a unique value auto-generated by the
server to identify the report.</p>
</li><li><p><span><span> 
</span></span>The report <b>Report.Description</b> to an empty value.</p>
</li><li><p><span><span> 
</span></span>The report <a href="23576b19-7291-47b9-91a0-5a38b1fc31d3" data-linktype="relative-path">Report.Deprecated</a>
to false.</p>
</li><li><p><span><span> 
</span></span>The report <b>Last generated file name prefix</b> to an empty
value.</p>
</li><li><p><span><span> 
</span></span>The report <b>Filters</b> to a value returned by <a href="acccc108-9714-4b34-b8e9-726cf203c854" data-linktype="relative-path">IFsrmReportManager::GetDefaultFilter (section 3.2.4.2.33.7)</a>.</p>
</li></ul><p>If a report of the specified type already exists for the
report job, the server MUST return FSRM_E_REPORT_TYPE_ALREADY_EXISTS.</p></div>