Policy Feature Definitions in SharePoint Server 2010 (ECM)
Last modified: April 02, 2010
Applies to: SharePoint Server 2010
In this article
Specifying Global Custom Settings Control
Specifying Custom Settings Control
Specifying Feature Assembly and Class
Specifying Policy Resources
Adding a Policy Feature Definition to the Policy Feature List
A policy feature definition is a section of XML that provides the information Microsoft SharePoint Server 2010 requires to do the following:
Include the creation and configuration of the policy item in the SharePoint Central Administration interface.
Call the policy feature code for tasks such as initializing the policy feature.
To facilitate creation and configuration of the policy item, the Policy Feature Definition can include the URL addresses of two Web controls: one for server farm–level policy feature settings, and the other for policy instance–level policy feature settings. These Web controls are hosted within SharePoint Server 2010 and enable the appropriate users to set settings at the appropriate levels.
The server farm–level Web control is hosted on the administration page for that policy feature, and enables administrators to specify settings for the policy feature for the entire server farm. These settings, referred to as global settings, cannot be viewed or changed by users who are not administrators. The global settings are saved within the Policy Feature Definition. For example, the Bar Code policy feature contains a global setting that enables the server administrator to select the bar code generator to use with the policy feature.
The server farm–level Web control must implement the GlobalCustomSettingsControl class.
If you do not specify a global custom settings control, administrators do not have the ability to overwrite or edit the default global data specified for the policy feature, and therefore cannot customize the feature at the administrator level. This limits the administrator's options to either activating the policy feature or not activating the policy feature.
The policy instance–level Web control is hosted on the policy item customization page, because it enables the user to specify custom settings that apply to the policy feature within a specific policy. These custom settings are saved within the specific policy’s policy item for that policy feature. For example, the Bar Code policy feature contains the following settings that the user can specify for each policy in which the policy feature appears:
Automatically provide bar codes.
Prompt user to include bar codes in documents.
The policy instance–level Web control must implement the CustomSettingsControl class.
If you do not specify a custom settings control, users do not have the ability to overwrite or edit the default data specified for the policy feature, and therefore cannot customize the feature at the end-user level.
For SharePoint Server 2010 to be able to call the policy feature code to perform required tasks, such as initialization, the Policy Feature Definition must contain two specific pointers: one to the location of the strong-named policy feature assembly in the global assembly cache, and one to the class within that assembly that implements the IPolicyFeature interface.
If a policy feature uses policy resources, it must list the type of resources it uses in its Policy Feature Definition. For example, the Bar Code policy feature includes in its Policy Feature Definition an element indicating that it uses policy resources of type "Bar Code Generator". The policy feature can then use any resource that declares in its Resource Definition that it is of type "Barcode Generator". The policy resource name must be fully qualified and must appear on the Policy Resource Definition List for that policy feature.
Policy resources can be specified as required or optional within the Policy Feature Definition. If you install a policy feature that requires a policy resource of a specific type, and no policy resources of that type are installed on the farm, then you cannot activate that policy feature.
Figure 1 shows the information contained within the Policy Feature Definition, and the items that the information references.
The Policy Feature List includes the Policy Feature Definitions for each policy feature installed on a specified server farm. You can add a site policy by calling the Add method of the PolicyFeatureCollection class. This method adds the XML passed to it to the Policy Feature List as the Policy Feature Definition for the policy feature.
This is usually done as part of deploying the policy feature as a SharePoint Foundation Feature. For more information, see Using Features in SharePoint Foundation.
After you add a Policy Feature Definition to the Policy Feature List, you can work with the policy feature programmatically, as a PolicyFeature object in the object model.