Programmatically Create Retention Schedules
Let’s suppose you are migrating from an existing Records Management solution to Records Center in SharePoint 2010 to manage your records retention and disposition. How do you import and/or create your existing file plan in SharePoint? The Microsoft.Office.RecordsManagement.InformationPolicy assembly that ships with SharePoint Server 2010 has some methods to help you.
- If you are enforcing policy based on library and/or folder, you would use ListPolicySettings.SetRetentionSchedule provided by SharePoint 2010.
- If you are using Content Types to enforce your retention schedule, then you would use Policy.CreatePolicy on the Content Type and put your retentionXml in the CustomData of the PolicyItem.
When you read through the msdn article, it is unclear exactly how to construct the retentionXml parameter to provide a retention threshold/duration/activity. A sample retentionXml fragment that will start a workflow ten years after a document is created is included below. Another great blog post that outlines how to define custom expiration formulas and activities (as well as more xmlRetention samples) is available as well.
<Schedules nextStageId="2" default="false">
<data stageId="1"><formula id="Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration.Formula.BuiltIn">
<action type="workflow" id="3b3dc6ae-283f-4455-a156-175dd2fa87e9" />