Share via


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.

  1. If you are enforcing policy based on library and/or folder, you would use ListPolicySettings.SetRetentionSchedule provided by SharePoint 2010.
  2. 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">

   <Schedule type="Default">

      <stages />

   </Schedule>

   <Schedule type="Record">

      <stages>

         <data stageId="1"><formula id="Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration.Formula.BuiltIn">

            <number>10</number>

            <property>Created</property>

            <propertyId>8c06beca-0777-48f7-91c7-6da68bc07b69</propertyId>

            <period>years</period></formula>

            <action type="workflow" id="3b3dc6ae-283f-4455-a156-175dd2fa87e9" />

         </data>

      </stages>

   </Schedule>

</Schedules>