Export (0) Print
Expand All

IPolicyFeature Interface Overview (ECM)

Last modified: April 02, 2010

Applies to: SharePoint Server 2010

When you initially apply an information management policy to an item, policy features must often perform certain operations to initialize the feature's policy enforcement on that item. This initialization can include the following actions:

  • Creating a column on the item's list. For example, the Expiration policy feature creates a new column, named ExpireDate, on items to which you apply it.

  • Registering for events on the item's list.

  • Performing some work on the item. For example, the Expiration policy feature computes the initial value of the ExpireDate column on items to which you apply it.

In addition to installing a valid Policy Feature Definition, each policy feature must also contain a class that implements the IPolicyFeature interface. This interface enables Microsoft SharePoint Server 2010 to call the code to perform any initiation work that the policy feature requires. The interface also enables SharePoint Server 2010 to call the code to perform any tasks required when a policy item that is associated with the policy feature is added, deleted, or changed for a content type.

SharePoint Server 2010 calls the appropriate method when policy items are added, deleted, or changed for a content type.

The IPolicyFeature interface contains the following methods:

  • OnCustomDataChange

    Called by SharePoint Server 2010 when a user changes the custom settings on a specific policy item associated with the policy feature.

  • OnGlobalCustomDataChange

    Called by SharePoint Server 2010 when a user changes the server farm-level settings for a policy feature.

  • ProcessListItem

    Called by SharePoint Server 2010 when a policy changes. Changes include editing the policy currently assigned to the list, or assigning a different policy to the list.

    Note Note

    If a policy feature returns false, SharePoint Server 2010 does not process the remaining items. This optimization prevents SharePoint Server 2010 from iterating through all the items on a list for policy features that are not involved with processing the item.

  • ProcessListItemOnRemove

    Called by SharePoint Server 2010 on list items that are no longer subject to the specified policy. This method lets you specify item level un-registration that needs to be performed when the policy is removed from an item.

  • Register

    Called by SharePoint Server 2010 when a user adds a new policy item to a policy. This method performs any required initiation work for the policy feature, such as adding specific columns to the content type, or registering for events.

  • UnRegister

    Called by SharePoint Server 2010 when an existing policy item is removed from a policy.

When you add a policy item to a policy, SharePoint Server 2010 calls the Register method of the associated policy feature to perform any required initiation work.

Similarly, if you delete a policy item from a policy, SharePoint Server 2010 calls the UnRegister method of the associated policy feature to perform any needed cleanup work.

When a policy changes, SharePoint Server 2010 calls the ProcessListItem method for each policy feature that changed. If the policy feature has not changed, SharePoint Server 2010 does not call any methods.

For example, suppose your policy for a given content type contains one policy feature, Bar Codes, and you then add a policy item for the Expiration policy feature. SharePoint Server 2010 calls the Register method of the Expiration policy feature to initialize the feature on each item that is assigned to that content type. However, because the policy item for the Bar Codes policy feature has not changed within the policy, SharePoint Server 2010 does not call the ProcessListItem method of that policy feature.

Show:
© 2014 Microsoft