Steps To Create Site Content Types In SharePoint 2013 Using Visual Studio

Introduction

A SharePoint site content type gets an item and information about the items. Site content types help make it easy to provide consistency across a site collection. By defining site content types for specific kinds of documents or information, you can ensure that each group of content is managed in a consistent way. In this article, I will explain how to create Site Content Types in SharePoint 2013 using Visual Studio.

Pre-Requisites

  1. Open Visual Studio.
  2. Open New Project dialog box. Expand Office/SharePoint node and then choose SharePoint Solutions.



  3. Choose the "SharePoint 2013 – Empty Project" template. Name the project as ExampleSharePointProject.



  4. Choose the "Deploy as a farm solution" option and click Finish.



  5. ExampleSharePointProject SharePoint project has got created.



  6. Right click on ExampleSharePointProject -> Add -> New Folder. And name the folder as Site Columns.



  7. Create the site columns in the ExampleSharePointProject.



Create Site Content Type

  1. Right click on ExampleSharePointProject -> Add -> New Folder. And name the folder as “Site Content Types”.



  2. Right click on Site Content Types folder ->Add -> New Item.



  3. Add Column Type from the Add New Item window. Name it as “PersonalContacts”.



  4. Select the base content type, should this content type inherit.



  5. Select the site columns which we created previously and also select it from already existing default site columns.



  6. Complete the selection process of all the site columns added to PresonalContacts site content type.



  7. Give the description and content type group which this content you want to appear in.



  8. Elements.xml file also displays the same information as we given.



  9. Once you create a site column and site content type, you will notice that Visual Studio has automatically added a Feature to the project and included the new site column “FirstName” and content type “PersonalContacts” in it.



  10. Build and deploy the SharePoint solution.
  11. Open the SharePoint site, go to “Site Settings” -> “Site Content Types” under Web Designer Galleries.

  12. List of site content types present in the site appears. Select the “Custom Content Type” group. Our “PersonalContacts” site content type appears.



  13. We can use these content types to our custom lists.

Summary - Thus, you learned how to create Site Content Types in SharePoint 2013 using Visual Studio.