Home > SharePoint, SharePoint 2010 > SharePoint 2010: How to programmatically Block Edits and Deletes on Records

SharePoint 2010: How to programmatically Block Edits and Deletes on Records


In a Records Management solution it is often required to prevent records from being able to be deleted or edited, particularly for In Place Records.

This can be set easily using the Record Declaration Settings in Site Actions on the site collection to set Record Restrictions to Block Delete or Block Edit and Delete. However it is not obvious how this can be done via the object model.

After a little investigation using SharePoint Manager, I came across a web property called “ecm_siterecordrestrictions”. Setting this property has the desired effect, and can take the values “None”, “BlockEdit”, or “BlockDelete, BlockEdit”.

So if you have an SPWeb object called “web”, the following 2 lines will block deletes and edits:

web.AllProperties["ecm_siterecordrestrictions"] = "BlockDelete, BlockEdit";
web.Update();

Notice that this property indicates that it is setting ‘site’ record restrictions. This needs to be set on the root web of the site collection to take effect on the whole site collection. Setting this on any other web does not to take effect. This is backed-up by the fact that the Record Declarations Settings link in the UI is only available in Site Collection Administration.

Advertisements
  1. June 7, 2012 at 12:37

    Thank you !
    There is a method though API but it doesn’t work, it says that BlockDelete must be set if you want to set blockEdit

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: