Tutorial :Hierarchical expiration policies on individual items


I am looking to implement a custom policy for item expiration on a custom list (not a document library).

This policy must be editable on an item-per-item basis, and compute the expiration date based on user-defined rules such as: number of accesses, expiration timespan, or any aggregation of the two rules above. Because of this granularity, I cannot use the default expiration policies model (or implement a custom one), nor the default audit in my expiration policy.

As the items are organized in folders and subfolders, I would like to apply the policies hierarchically (similar to the OOTB permission model).

My solution would be to create custom content types for the folders and the items in order to include a column which will hold the serialized rules, while the access to this "rules" field would be synchronized manually from code. A custom Infopath form would be used to edit the attached rules for each entry in the list (be it Folder or Item), and this data would be used by a custom application page to grant access to the item or not (based on additional item fields, it also does the actual job for each item). While I am not exactly sure the above solution would be approved (company policy might forbid me to edit toe Global.asax file for the synchronization scheme), I am wondering if anyone may come with a better architecture for this requirement?


Ok, I will give it a shot. First, I would forget about InfoPath and go for a custom ASPX page for configuring policies. The whole project should be packaged in a WSP solution with the following ingredients:

  1. Policy configuration aspx page in the _layouts folder. This page should enable users to create and edit policies for lists, folders and items. The page could in turn serialize and store rules in the property bag on list items. For list level rules, use the SPWeb property bag. Alternatively, create a hidden list where all rules are stored in XML files associated with a list, folder or item.

  2. Site Collection Feature that adds Custom Actions to your custom list for adding and editing policies. You could add a custom action like "Edit Policy" to the ECB menu on folders and items. For list level policies, you add a similar action to the list actions menu.

  3. SharePoint Timer Job for enforcing the policies. Use a farm level feature to install the timer job in a feature receiver on activation.

No matter what, I think you will face a fair amount of development effort.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »