共用方式為


I_IrmProtector.HrProtectRMS Method

Applies to: SharePoint Foundation 2010

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

HRESULT HrProtect(
    ILockBytes       *pilbInput,
    ILockBytes       *pilbOutput,
    I_ IrmPolicyInfoRMS    *piid,
    DWORD            *pdwStatus
) PURE;

Parameters

pilbInput

[in] The unprotected file.

pilbOutput

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

piid

[in] A link to functions and data that assist with the encryption/decryption process.

pdwStatus

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

MSOIPI_STATUS_UNKNOWN

The result of the method cannot be determined.

MSOIPI_STATUS_PROTECT_SUCCESS

The protector has successfully generated the protected file stream.

MSOIPI_STATUS_ALREADY_PROTECTED

The file is already IRM protected.

MSOIPI_STATUS_CANT_PROTECT

A general failure of the protector.

MSOIPI_STATUS_NOT_MY_FILE

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

MSOIPI_STATUS_FILE_CORRUPT

The specified file is corrupt.

MSOIPI_STATUS_WSS_IRM_FAILED

The protector is unable to access SharePoint Foundation functions, or those encryption functions have failed.

MSOIPI_STATUS_BAD_INSTALL

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.

Remarks

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:

This method takes a stream of data that represents an unprotected file of a type that the IRM protector can understand, and then generates a corresponding data stream that represents a protected version of that file. This protected version should include the document issuance license (IL) of the protected file, and the EUL of the server, as well as the encrypted file content itself.

The file type developer must decide where and how these data components are stored within the file. However, the IRM protector should be in agreement with the client application used to view and edit files of this file type.

The protected stream can also include a warning message that is backward-compatible with previous versions of client-side viewers of the protector’s file type.

For autonomous IRM protectors:

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

See Also

Reference

I_IrmProtector Interface

I_IrmPolicyInfoRMS Class

I_IrmPolicyInfo Class

Concepts

Information Rights Management in SharePoint Foundation

Custom IRM Protectors