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>