0

How to make a field required in the schema of a list, I have this example, but the field is still not being required.

<Field ID="{xxxxxx-xxx....}" Type="Text" Name="Title" DisplayName="User" Required="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" MaxLength="255" AllowDuplicateValues="FALSE" EnforceUniqueValues="TRUE" Indexed="TRUE" />

Does anyone knows how can I do that?

I made a mistake, what I want to know is how to make a field UNIQUE VALUE in the schema of a list

  • The Required="TRUE" should do it. Title is a reserved name in most cases (even tho you're prob just using that as an example) – Michael Colbs May 20 '14 at 19:59
  • I made a mistake, what I want to know is how to make a field UNIQUE VALUE in the schema of a list – Andres Williams May 20 '14 at 20:15
2

Keep these attributes:

Required="TRUE" EnforceUniqueValues="TRUE" Indexed="TRUE"

and remove:

AllowDuplicateValues="FALSE"

in both the Elements.xml and the Schema.xml of your list definition.

  • 2
    not working with the field Title (default of list) – Andres Williams May 22 '14 at 16:17
0

You already posted a part of the answer to your question. Required="TRUE" is the key to the solution.

First of all, the List Schema is described here.

You could use SharePoint Designer. Here is a video showing how to this for SharePoint 2010.

Or you can create a SharePoint Project in Visual Studio and add a list there. How to do this is described here.

  • I made a mistake, what I want to know is how to make a field UNIQUE VALUE in the schema of a list – Andres Williams May 20 '14 at 20:18
  • There you go. And this for the field definition: EnforceUniqueValues = "TRUE" | "FALSE" – Markus May 20 '14 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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