Part 1 of showed you the beginning of a feature, by creating and defining a feature.xml file. Part 2 then showed you an element manifest file defining 3 different columns. We will now move on to Part 3. Here, we will create another file defining a new content type using the columns created in Part 2. So without further ado we shall begin.
Custom Content Type
From the folder within our project, add in a new XML file naming it as specified within your <ElementManifest>. In my case that would be CustomContentType.xml.
I then go ahead and define the content type.
The above screenshot shows you how I defined a content type called “Feedback”. I would like to stress on 2 particular parts that is shown above.
Firstly, as with columns (fields) and the feature, an unique guid is assigned to the content type. Notice however that the length of the guid seems longer? Well, this is because the “Feedback” content type is inheriting from the Item base/parent content type. Which means, we would actually have to prefix the base type ID before the guid. MSDN has two different approaches for constructing a valid content type ID, and I tend to go with the second approach.
The second part that I would like to point out is the <FieldRefs>, as you can see in here I’ve defined the 3 columns created in Part 2 to be used with the “Feedback” content type. I did this by specifying the column (field) guid, name and display name as <FieldRef> individually.
Well, that’s it for Part 3, we now have a content type definition within our feature as well. In the next post, we will create a custom list that uses this content type.
Twitter
Linkedin
Live


