Just little about C#, .NET, SQL Server, SharePoint and SAP

Custom Document Expiration Policy – Part-3: Additions

Posted by zieglers on January 18, 2010

This post will detail some functional extensions implemented for Custom Expiration Policy.

You can find previous posts related to Custom Expiration Policy here:

Previously, we implemented our custom expiration policy to take advantage of OOTB delete action. This means when a document expires, it is simply deleted.

In this post we’ll look into details of how to perform a custom action when document expires. Here are the requirements for custom action:

  • First, log expiration warning details to a list called Expiration Warnings.
  • Then, upon expiration, log expiration details to a list called Expiration History.
  • Finally, delete document.

So, that’s how Expiration Warnings and Expiration History lists look like.

Once our custom expiration action is deployed, it shows up in expiration settings under ‘Perform this action‘ dropdown list. I called it ‘Expiration Event Logger‘.

Implementation of custom expiration action is similar to implementation of expiration formula calculation. All we need to do is to implement IExpirationAction interface which can be found in Microsoft.Office.RecordsManagement.PolicyFeatures namespace.

Above OnExpiration method is called once document expires. Here, first we are creating Expiration History List and then deleting the expired document.

In order to create a list and write an entry in it, i used a helper class called ExpirationHistoryList, whose implementation can be seen below.

There is only one constructor. This constructor gets Expiration History List object if created. If it’s not created yet, it creates one.

In addition, WriteEntry method creates log entry in the list along with expiration event details such as document title, list name, web title, … etc.

That concludes this post – logging functionality for expiration policy.

Things to do next: Managing document expiration once expiration warning period is reached using Expiration Warnings list.


3 Responses to “Custom Document Expiration Policy – Part-3: Additions”

  1. […] Custom Document Expiration Policy – Part-3: Additions […]

  2. […] Ziegler provides a cool intro, implementation sample and much more. […]

  3. teokono said

    I called it ‘Expiration Event Logger‘ – where exactly?

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: