Monday, December 2, 2013

Check if the Retention Policy already exits in SharePoint

                 
SPSite objSite = "";
            SPWeb objWeb = null;
            SPContentType objContentType = objWeb = objSite.OpenWeb();
                 objContentType = objWeb.ContentTypes[strContentType];

                 Policy spPolicy = Policy.GetPolicy(objContentType);
                 if (spPolicy == null)
                 {
                     Policy.CreatePolicy(objContentType, null);
                     spPolicy = Policy.GetPolicy(objContentType);

                }

No comments:

Post a Comment