I_IrmProtector.HrUnprotect Method

Applies to: SharePoint Foundation 2010

Generates an unprotected version of the specified rights-managed file.

HRESULT HrUnprotect(
    ILockBytes       *pilbInput,
    ILockBytes       *pilbOutput,
    I_IrmPolicyInfo    *piid,
    DWORD            *pdwStatus



[in] The rights-managed file.


[out] The unprotected stream that the Information Rights Management (IRM) protector generates from the rights-managed file.


[in] A link to data about the file to protect, and the user requesting it.


[in] The status of the method call. Possible values are:


The result of the method cannot be determined.


The protector has successfully generated the unprotected file stream.


The specified file is not protected.


A general failure of the protector.


The specified file is not of a file type associated with this IRM protector.


The specified file is corrupt.


The protector is unable to access its rights management platform.


The protector is not installed properly.

Return Value

The protector methods return typical HRESULT values. In general, the protector should return a positive OK value for success or a negative FAIL value when unsuccessful.


The I_IrmProtector Interface is implemented by both integrated and autonomous IRM protectors. For more information about integrated and autonomous protectors, see Custom IRM Protectors.

For integrated IRM protectors:

Integrated protectors do not need to implement this method. An integrated protector should return the HRESULT E_NOTIMPL if this method is called.

For autonomous IRM protectors:

SharePoint Foundation calls this method to unprotect rights-managed files of the file types associated with this protector. For autonomous protectors, you must implement the I_IrmProtector.HrProtect Method method so that it configures and executes the entire rights management process.

In general, you should implement the HrUnprotect5 method of an autonomous protector so that it accomplishes the following tasks:

Use the piid parameter of the I_IrmPolicyInfo.HrSetListGuid Method method to provide SharePoint Foundation with the document library GUID that is stored in the rights metadata of the file. SharePoint Foundation uses this GUID to ensure that the file is uploaded to the document library from which it was downloaded.

  • Use the pilbOutput argument to provide SharePoint Foundation with an unencrypted version of the file.

  • Return the appropriate status value in the pwdStatus argument.

See Also


I_IrmProtector Interface

I_IrmPolicyInfoRMS Class

I_IrmPolicyInfo Class


Information Rights Management in SharePoint Foundation

Custom IRM Protectors