Friday, October 7, 2011

Create custom list using Content Type and Schema.xml file

Creating a schema for a custom SharePoint list has always been something I think which could be much improved upon, as it is always something that may cause you to pull out your own teeth.

In my experience the easiest way to do this is to replace the  ContentType tags with the following:


Then it's as simple as adding your fields within the field tags of your schema.xml file, see below:

You can always use the GUID generator that comes with Visual Studio to generate new GUID's for your different fields.

Once complete, if you wish for your fields to be displayed in your view, add them to your ViewFields tags, (ViewFields tags can be found within the Views, View tag of your schema.xml file) as shown below:

You have now successfully created a working schema.xml file, hope this helps in stopping you from tearing your hair out.