One of our projects makes use of Information Management Policies in SharePoint Server. We were programmatically adding these policies to Content Types, but for some reason this didn’t work when we migrated the application to SharePoint 2010.
Issue
We receive the following error:
System.ArgumentException: Invalid field name. {b0227f1a-b179-4d45-855b-a18f03706bcb} http://intranet
at Microsoft.SharePoint.SPFieldCollection.GetFieldById(Guid fieldId, Boolean bThrowException)
at Microsoft.SharePoint.SPFieldCollection.get_Item(Guid id)
at Microsoft.Office.RecordsManagement.InformationPolicy.Policy.EnsurePolicyFields(SPContentType ct)
at Microsoft.Office.RecordsManagement.InformationPolicy.Policy.CreatePolicy(SPContentType ct, Policy globalPolicy)
at VNTG.Initialisation.AddVersionLabelToContentType(SPContentType ctype)
If you dig deeper on that Field ID you quickly find that it’s the _dlc_Exempt field, one of the system fields for Policies.
At first we manually added them to our Content Types, but that didn’t feel right. It fixes the issue and allows you to work with the Content Type, but as soon as you start adding them to document libraries you’ll see strange things appearing. Fields are listed twice or missing in the List Content Type view, etc.
Solution
No need to manually start adding hidden system fields to your content types, just enable the “SharePoint Server Standard Site Collection features” feature on the Site Collection.