Below you will find pages that utilize the taxonomy term “policy”
Posts
Retention policies
Ziegler provides a cool intro, implementation sample and much more. When deployed we can apply this policy to a contenttype in the UI, or in code. To create our own expiration logic we have to implement IExpirationFormula and its ComputeExpireDate:
public class TaskExpiration : IExpirationFormula { public DateTime? ComputeExpireDate(SPListItem item, XmlNode parametersData) { if (!item\["Status"\].Equals("Completed")) { return null; } var dt = (DateTime) item\["Modified"\]; return dt.AddDays(30); } } ```In order to see IExpirationFormula, add a reference to Microsoft.