Adding a custom action to the moss expiration Policy

Source: Internet
Author: User
Adding a custom action to the moss expiration Policy

Office Sharepoint 2007 out of the box has a policy framework, that can help with information management in your organization. on of the out of the box parameter IES is the expiration policy. you can setup a policy for a site collection, content type of Sharepoint list that will expire your item after a certain number of days, months or years after one of the Date Field Values in your item. you can expire all whitepapers for example 5 years after they have been last modified.

The action to SharePoint will perform when the item expires depends on you, out of the box there are 2 options: the items is deleted or a workflow is started. if a workflow is available for the content type or list, it will be listed in the dropdown.

It is also possible to create your own actions. After you have created and registered your action, it will show up in the "perform this action" dropdown In the screenshot above.

Step 1-implement the interface

To create a custom action, you need to implement the iexpirationaction interface that can be found in the namespace Microsoft. Office. recordsmanagement. features.

Public Class Expirationsendwarning: Iexpirationaction
Public VoidOnexpiration (Microsoft. Sharepoint. splistitem item,
System. xml.XmlnodeParametersdata,DatetimeExpireddate)
// Do whatever you need to do with you item when it expires

You need to put this in a strong named assembly and add it to the GAC.

Step 2-create the registration XML

After creating the expiration action, you need to register it by creating an XML file. you will find an example below. the featureid attribute of the policyresource element is important. this needs to be the ID of the out of the box expiration policy. the rest is pretty clear. save this XML to a file called "actionmanifest. XML"

<?XML Version="1.0" Encoding="UTF-8"?>
<P: policyresource ID="Tst. POC. policyfeatures. expirationsendwarning"
Featureid="Microsoft. Office. recordsmanagement. policyfeatures. Expiration"
Type="Action"Xmlns: P="URN: Schemas-Microsoft-com: Office: SERVER: Policy">
<P: localizationresources>Dlccore</P: localizationresources>
<P: Name>Expirationsendwarning</P: Name>
<P: Description>Sends a warning on the reminder date</P: Description>
<P: publisher>Ton stegeman</P: publisher>
<P: assemblyname>
Tst. POC. policyoftruth, version =, culture = neutral,
Publickeytoken = 503edd7b21a1_b3
</P: assemblyname>
<P: classname>Tst. POC. policyfeatures. expirationsendwarning</P: classname>
</P: policyresource>

Step 3-register the expiration action

The last step is to register the action. To do that, you run the example piece of code below from any type of application you like best:

StringActionmanifest = system. Io.File. Readalltext ("Actionmanifest. xml");
Policyresourcecollection. Add (actionmanifest );

The policyresourcecollection can be found in the namespace "Microsoft. Office. recordsmanagement. informationpolicy". Both for Step 1 and 3 you need a reference to Microsoft. Office. Policy. dll

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.