In this post you will learn how to develop content type using visual studio 2010 which will be used across all the sites in the site collection level.
To develop content type lets start
To create a Content Type using visual studio, we need to create "Content Type" project using SharePoint 2010 template. In this example we name our project as "ContentType".
Once you click Ok from the above screen a wizard will start, in this you need to enter the site url which you wanted to debug and Select the SharePoint solution as a Farm solution and Click on Next.
The IncidentDetailsCT we are going to develop in this example is getting inherited from base Item content Type. So select Item from the dropdown and click Finish button.
Once the projected got created, the project structure will look like below screenshot.
For this IncidentDetailsCT we are setting scope as the Site (Site collection) level, so that this can be used across the site collection.
Even we can set the scope of IncidentDetailsCT to the web (site) level but it will be available to only that site and cannot be used at a higher scope which is at site collection level.
Read more here about the scope of content types.
Please see the below Elements.xml file of a content type. If you observe the content type ID
It (0x01000bc0b06140de4019aa00b227a8d5a35c) represents that content type is inherited from the base content type Item.
0x01 (Item Content Type) + 00 + bc0b06140de4019aa00b227a8d5a35c (GUID).
You can read here more about content type ID structure.
You need to add the columns which are required inside <FieldRefs> tag. In this example we are using the site column which we have created from the previous article of develop site column using visual studio.
Once you build the content type, it will be available under [site actions][Site setting] [Galleries] [Site content types].
If you further click on IncidentDetailsCT it will show the parent CT and columns available in the same.
In this post you have learned how to develop content type using visual studio 2010.
Devendra Velegandla is a four-time recipient of Microsoft's Most Valuable Professional (MVP) award (2014-2017) for Office Servers and Services MVP and SharePoint Server.He received the MCC award for his contributions in Microsoft MSDN/TechNet forums.He loves sharing articles, videos and tutorial on SharePoint and Office 365.