Posted by: R Manimaran | January 27, 2011

SharePoint 2010: Enforce Primary Key and Referential integrity in List

SharePoint 2010: Enforce Primary Key and Referential integrity in List

Primary Key:

In 2007 we have to write separate Javascript to enforce uniqueness on a Column in a SharePoint List. But in 2010, we have a option in the List through which we can enable uniqueness on the SharePoint List.

After enabling the Enforce unique values, entering the duplicate value will throw the error message as follows

Referential integrity

If you are using any Lookup column in a List we have the option to enable referential integrity on that column.

In SharePoint 2010, there are two types of option

Restrict Delete: Deleting a parent item which has a reference in the child item will not allowed and will through the error.

Cascade Delete: Deleting the parent item will delete the corresponding Child item(s).

If Cascade Delete is enabled for the lookup column following warning message will be shown on deleting the parent Item.

On Clicking Ok it will Delete the corresponding child items too.

If you check the recycle bin after deletion, you will be shown like this.

In Recycle bin only the parent item will be shown. But the Icon (type) which will represent that it holds some child items. [Icon looks something like relationship in tables].

On restoring this item will also restore the corresponding child items.

Advertisements

Responses

  1. There are 3 options for referential integrity namely: Delete, Cascade and the default which is None.

  2. This is one of the best articles so far I have read online. No crap, just useful information. Very well presented. Its really helpful for beginner as well as developer. Thanks for sharing with us. Check out this link too its also having a wonderful explanation on referential integrity in sharepoint…

    http://mindstick.com/Articles/866d97d3-7b96-4e38-a38b-fc4ed183af3f/?Referential%20Integrity%20in%20SharePoint%202010


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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Categories

%d bloggers like this: