Friday, May 6, 2011

Enforce unique constraint from code

We have seen in previous posts that it is very easy to set field with the unique constrain from list settings. We are going to see the same using code that how to do that

Below is a sample code to achieve that. We must remember that before a field can be set to unique constraint, we have to index that field and hence we have also set that as well.

No comments:

Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to