Introduction
Content Types are set of columns grouped together to serve a specific purpose.
A content type is a group of reusable settings of shared attributes and behaviours for a specific kind of content. It mainly used for defining item type, documents, list items, media files & folders.
While creating a custom content type child content type must be derived from the one of existing parent content type such as Image, Task, Document or Item. Once it is created in a site, a custom content type is available in that site and in all sites nested under that site.
To make a content type most widely available throughout a site collection, define it in the content type gallery of the top-level site. In the On-Premise environment of Share Point a custom content type can be also created inside a content type hub that is defined in a managed metadata service instance.
In this article, you will learn how we can create content type using Visual Studio and PowerShell for On-line and On-Premise environment.
Prerequisites
- Share-Point 2019 On-Premise Environment
- Share-Point Office 365 Tenant
- Visual Studio
- Share-Point Management PowerShell
Content Type Creation for On-Prem Environment Using Visual Studio
Open Visual Studio and create a new project.
Select SharePoint 2019 Empty Project - C# (Language).
Enter the Project Name. In our case, I created the Project Name as CustomContentType.
In the Next Screen, we need to establish the connection between CustomContentType project with our SharePoint On-Premise environment.
Note
SharePoint 2019 environment doesn’t support the sandboxed solution, we need to deploy our application at the Farm Level as a Farm Solution.
SharePoint 2019 environment doesn’t support the sandboxed solution, we need to deploy our application at the Farm Level as a Farm Solution.
Once the project is created, we will have the project solution ready. During this creation, our SharePoint Application comprises of 2 key things or also known as special node.
- Feature – It’s a container of extension of one or more SharePoint features.
- Package – Single File which can be deployed and reusable.
Add New Item to the SharePoint Project (Ctrl+Shift+A) Select Content Type.
Parent Inheritance of Content Type
Even with the custom content type creation, it needs to be inherit from one of the available existing content types that is available in our site collection.
Note
In our application we have selected the Document as Parent Content Type and finish.
In our application we have selected the Document as Parent Content Type and finish.


Andriy ZapisotskyiPosted Nov 4, 2019, 11:47 AM
Great read