3.2.4.2.45.16 CreateRule (Opnum 22)

The CreateRule method creates a blank Non-Persisted Rule Instance (section 3.2.1.6.3.2) with the specified classification rule type and returns S_OK upon successful completion.

 [id(FSRM_DISPID_CLASSIFICATION_MANAGER | 0x05)] HRESULT CreateRule(
   [in] FsrmRuleType ruleType,
   [out, retval] IFsrmRule** Rule
 );

ruleType: Contains the FsrmRuleType (section 2.2.1.2.11) of the classification rule to create.

Rule: Pointer to an IFsrmRule interface pointer (section 3.2.4.2.41) that upon completion points to a blank classification rule. To have the rule added to the server's List of Persisted Rules (section 3.2.1.6) the client MUST call Commit (section 3.2.4.2.10.5) on the rule. The caller MUST release the rule 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

0x80070057

E_INVALIDARG

This code is returned for the following reasons:

  • The ruleType parameter is not FsrmRuleType_Classification.

  • The rule parameter is NULL.

Upon receiving this message, the server MUST validate parameters:

  • Verify that Rule is not NULL.

  • Verify that ruleType equals FsrmRuleType_Classification.

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

Upon successful validation of parameters, the server MUST perform the following actions.

  • Create a new Non-Persisted Rule Instance of the specified type.

    • Set FSRM Base Object.Id to a GUID.

    • Set FSRM Base Object.Description to an empty string.

    • Set FSRM Base Object.Deleted to false.

    • Set Rule.Name to an empty string.

    • Set Rule type to ruleType.

    • Set Module definition name to an empty string.

    • Set Namespace roots to an empty list.

    • Set Enabled/disabled to enabled.

    • Set Valid/invalid to valid.

    • Set Rule.Parameters to an empty list.

    • Last modified time is unspecified until the rule is committed by calling Commit (section 3.2.4.2.44.1).

    • Set Execution option to Evaluate unset.

    • Set Rule.Value to an empty list.

    • Set Rule.Deprecated to false.

    • Set Rule.ClearAutoProperty to false.<69>

    • Set Rule.ClearManualProperty to false.<70>

    • Set Property Affected to an empty string.

  • Set Rule to the IFsrmRule interface pointer for the newly created Non-Persisted Rule Instance.