In this article we will be seeing how to enforce unique value for a list or
library column in SharePoint 2010 using C# and powershell.
In SharePoint 2010 we can enforce uniqueness on values in a list or library
column, effectively creating a primary key. When you create a column in the list
or library you could see an option "Enforce Unique Values" where you can enforce
uniqueness. When you enforce uniqueness on a Lookup column, the list item in the
target list can have only one list item looking up to it from the child list.
Using C#: