Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have custom content type, custom list definition from this content type, and list instance in my visual studio project. I could not set Enforce Unique Values for Title Field. How can i achieve this.

Here is what i did:

In custom content type, i included title field (Elements.xml):

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Type="Text" Required="TRUE" EnforceUniqueValues="TRUE" Indexed="TRUE"  />  
 <!-- Parent ContentType: Item (0x01) -->
 <ContentType ...>
<FieldRefs>
  <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" />
</FieldRefs>
</ContentType>
</Elements>

Then in my custom list definition, i also included Title field (Schema.xml):

<ContentTypes>
  <ContentType ID="0x0100db7f2ee33f6f48efaac128f9e90eafd3" Name="..." Group="Micts Content Types" Description="..." Inherits="TRUE" Version="0">
    <FieldRefs>
      <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" />
    </FieldRefs>
  </ContentType>
</ContentTypes>
<Fields>
  <Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Type="Text" Required="TRUE" EnforceUniqueValues="TRUE" Indexed="TRUE"  />
</Fields>
share|improve this question
add comment

1 Answer

If "Title" is a custom field then you can override Validate method for your field type, or you can add a event receiver to your list. A similar question is explaining every possible way.

You can also try http://features.codeplex.com/

Hope it helps

share|improve this answer
add comment

Your Answer

 
discard

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.