Share via


Programmatically setting Record Declaration settings in SP2010

Needed to programmatically ensure that Record Declaration settings were set for a customer’s site template.

Found this blog entry: https://sharepointfieldnotes.blogspot.com/2010/08/making-your-sharepoint-2010.html

To summarize the information in the blog entry:

  • Allowing manual records declaration for all site in a Site Collection is done in the Site Collection Settings, under the “Record declaration settings” topic.
    • On the settings page, the “Record Declaration Availability” section allows an admin to turn manual record declaration on by default for all sub-sites.
    • In the “Declaration Roles” section: if you select the “Only policy actions” option then manual record declaration will not be allowed. Selecting either of the other two options (“All list contributors and administrators” or “Only list administrators”) allows manual declaration.
  • A Document library administrator can override the settings from the SPSite level using the record declaration settings for a specific library.
  • You have to reference the Microsoft.Office.Policy assembly (in the GAC or in the ISAPI folder in the 14 hive) to get at the object model required to check some of the settings for Records Declaration.
  • To check if the feature is enabled, use Records.IsInPlaceRecordsEnabled(SPList.ParentWeb.Site) .
  • To check if manual declaration is set for an SPWeb, check for and read the SPWeb.Properties[“ecm_SiteRecordDeclarationDefault" ”] property. If the value is true, manual declaration is enabled by default.
  • To check if a list is using list-specific settings, check for and read the value of SPList.RootFolder.Properties[“ecm_IPRListUseListSpecific”] . If true, well, the list uses list-specific settings.
  • To check if Manual Declaration is enabled in a specific list, use SPList.RootFolder.Properties[“ecm_AllowManualDeclaration”] . Remember that checking only for this overlooks the fact that the Manual Declaration may have been set at the SPSite level.
  • To validate Manual declaration is enabled, check that either:
    • List-specific settings are NOT set AND manual declaration IS set at the SPSite level; or
    • List-specific settings ARE set AND list-specific settings are set to true.

The referenced blog post provides code samples to check values using the logic described above. The rest of the blog post goes on to show how to check if a specific user can manually declare a record; how to check if a file is a record; how to actually declare—or undeclared—and item as a record (using code); and how to determine record restrictions (settings that can also be set using the UI’s Record Restrictions section.

In any case, I highly recommend reading through the post I’ve referenced above. I’ve summarized the information here just in case the referenced post gets taken down for some reason. But that post does a much better, much more thorough and useful job of explaining how this all works.