SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following field definition in the Schema.XML file for a custom list definition. Per the documentation setting EnforceUniqueValues and Indexed to true should enforce a uniqueness constraint on the field, but I am able to add duplicate values across list items through the UI.

      <Field Type="Text" 
             RowOrdinal="0" />    

Am I doing something wrong here? Is there somewhere else I need to set this attribute?

share|improve this question
Curious. Was this in the context of a Sandboxed or Farm solution? – Brian Apr 3 '12 at 16:25
It was a farm solution. – JohnFx Apr 3 '12 at 18:33
up vote 2 down vote accepted

Have you tried this for other fields than Title?

The spec for SPField.EnforceUniqueValues states that

You cannot set this property to true for a built-in field or for a site column.

Not 100% that this is valid for the declarative approachs for custom schemas, but test with another field "test" of type text and you will find out...

share|improve this answer
Ugh. I bet that's it. SharePoint is a minefield of stuff like this. – JohnFx Jun 22 '11 at 22:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.