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 a list definition which is not using content types, but instead by default has a title field. Besides this I've created one other field directly in the list definition.

I generated the list definition using visual studio. There is no mention of the title field in the xml schema under fields.

How would I go about ensuring that the title field should contain unique values in this list?

EDIT, I can do this using the GUI. So how can I generate / view the schema of a list in Sharepoint 2010. Then I would be able to see the list definition. Would be extremely useful info.

share|improve this question

3 Answers 3

Just add the Title-field with the right GUID and Name to the Schema and then you can add the attributes you need. You can find the GUIDS and the name (Field Definition) in the wssfields.xml within the fields-Feature.

share|improve this answer

To answer your question on how to view the schema, you can save the entire site with that list as a site template, then download it as a WSP from the templates Gallery.

In Visual Studio, create a new project from a WSP Solution (it's in the New dialog somewhere).

Locate your list def in there. Beware, the template file has EVERYTHING, so aboslutely tonnes of XML, but somewhere in there you should find what you want.

share|improve this answer
    
I actually found this. But instead I saved the list as a template. The list definition schema though looks a bit like greek, and it generated this line: <Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Type="Text" Name="Title" DisplayName="$Resources:core,Title;" Required="TRUE" StaticName="Title" EnforceUniqueValues="TRUE" Indexed="TRUE" MaxLength="255" />, but adding this to my custom list schema had no effect. –  user879 Jan 19 '11 at 10:54
    
Seems you need to have unique fields indexed in the list. Easy to do in code, not sure about doing it declaratively though... –  James Love Jan 19 '11 at 11:29

To see the schema of a list follow the instructions from this site.

Basically, navigate to http://[YourServer]/_vti_bin/owssvr.dll?Cmd=ExportList&List=[YourListGuid]

share|improve this answer

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.