3.2.4.2.45.26 SetFileProperty (Opnum 32)

The SetFileProperty method is used to set a Property Definition Instance on a file or folder.

 [id(FSRM_DISPID_CLASSIFICATION_MANAGER | 0x0F)] HRESULT SetFileProperty(
   [in] BSTR filePath,
   [in] BSTR propertyName,
   [in] BSTR propertyValue
 );

filePath: The file or folder that contains the Property Definition Instance that you want to set. You can specify an absolute or relative path to the file or folder. You cannot specify a file share.

propertyName: Contains the name of the Property Definition Instance whose value you want to set.

propertyValue: Contains the value to set the Property Definition Instance to.

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

Return value/code

Description

0x80045304

FSRM_E_PATH_NOT_FOUND

The specified file pointed to by the filePath parameter is not found.

0x80045306

FSRM_E_INVALID_PATH

The specified path is not valid. A path cannot be a relative path; it must be a full, absolute path to a file. A file share path cannot be specified.

0x80045354

FSRM_E_SET_PROPERTY_FAILED

The property could not be set.

0x80070057

E_INVALIDARG

The propertyValue parameter is not a valid for the type of property definition specified.

Upon receiving this message, the server MUST validate parameters:

  • Verify that propertyName is the Property Definition.Name of a Persisted Property Definition.

  • Verify that propertyValue is valid for the Persisted Property Definition specified by propertyName (section 3.2.4.6).

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.

  1. If a Property Definition Instance with the Property Definition Instance specified by propertyName does not exist, the server MUST return FSRM_E_NOT_FOUND.

  2. Perform Retrieve Stored Classification Properties for the file.

  3. If the List of Property Definition Instances contains a Property Definition Instance with the Property Definition.Name specified by propertyName, that instance's property definition instance.value MUST be set to propertyValue.

  4. If the List of Property Definition Instances does not contain a Property Definition Instance with the Property Definition.Name specified by propertyName, the server MUST create a new Property Definition Instance whose Property Definition.Name is set to propertyName and whose property definition instance.value is set to propertyValue. The server MUST then add that new instance to the List of Property Definition Instances for the file.

  5. If filePath is the path of a file and the List of Property Definition Instances contains a Property Definition Instance with Property Definition.AppliesTo set to Folders, the server MUST return E_INVALIDARG.

  6. If filePath is the path of a folder and the List of Property Definition Instances contains a Property Definition Instance with Property Definition.AppliesTo set to Files, the server MUST return E_INVALIDARG.

  7. Perform the Store Classification Properties action for the file given the List of Property Definition Instances from the previous actions.

  8. If any of the Property Definition instance.Flags of the Property Definition Instances in the List of Property Definition Instances contains the flag FsrmPropertyFlags_FailedSavingProperties, the server MUST return FSRM_E_SET_PROPERTY_FAILED.