How to use content types in SharePoint online [SharePoint Online list content types]

In this SharePoint tutorial, we will learn what is a content type in SharePoint Online and how to use content types in SharePoint Online. Also, we will see, how to create a SharePoint Online list content type from a SharePoint list.

We will also see how to enable Allow management content types to yes for the SharePoint List and Libraries to use content types inside a list or library. We will also see, step by step, how to change the order of the content types in the SharePoint lists.

What is a content type in SharePoint Online?

  • A SharePoint content type is an entity that uses site columns to define a schema of fields for an item in a list or a document in a document library. The content types are defined outside the scope of any list or document library.
  • A content type defines a field collection that is reusable across multiple lists or multiple document libraries. You can update a content type to make the changes available in all lists and libraries.
  • A content type represents a group of informational items in your organization that share common properties. Properties may be like name, description, a grouping category, etc.
  • SharePoint supports storing multiple content types in one document library. But only one content type can be applied to a particular item in a document library or list.
  • Each content type has a distinctive set of properties and metadata that describe the content. This can include fields that are associated with the content type that can be displayed as columns in the list or document library. It can also include a specific document template used when creating instances of the content type.
  • Either we can create a custom content type, or we can use the parent content type like List content type, document content type, folder content type, etc., We can add multiple content types to the same SharePoint list or library.
  • For example, if we create a content type called Training Course, it has a unique set of metadata columns like Training Courses Available, Training Course Price and Training Course Location.etc., Another example is if we create a content type called Employees, it also has some unique set of metadata columns attributes like EmployeeId, Employeerole, and EmployeeSalaryetc.,

Read Customize SharePoint site page

How to create a SharePoint Online list content type

Let us see how to create a SharePoint Online list content type,

To create a SharePoint Online list content type, we can easily Select the +Add column option and select the content type as mentioned below:

sharepoint content types
How to create a SharePoint Online list content type
  • Once the content type is selected in the SharePoint list, it redirects to the Add content type page displayed below.
  • Where we cannot see or choose any of the content type, just because none of the content type is available in the SharePoint List. We can also see the Apply button is disabled.
what is content type in sharepoint
How to create SharePoint Online list content type

To overcome this issue, Follow the below steps to create a SharePoint Online list content type:

  • Open the SharePoint Online List and select the Settings gear icon and click on the Site information.
content type in sharepoint
how to create content types in sharepoint online
  • In the Properties pane of Site information, select view all site settings option as shown below,
content types in sharepoint
How to create a content type in the SharePoint Online list
  • On the SharePoint site settings page, Select site content types under the Web Designer Galleries as shown below:
create a content type in SharePoint Online list
create a content type in the SharePoint Online list
  • Once the site content type is selected, it redirects to the content type gallery where we can see the option to create a content type, we can also see the existing site content type is presented in the content type gallery.
  • Now Select the + Create content type option as shown below:
create a content type in the SharePoint Online list
sharepoint list content type
  • Enter the Name of the content type in the Name field, and the Description field is optional.
  • Under Category either we can choose an existing site content type category or we can create a new category.
  • In this example, I have selected the Create a new category option and Entered the Category name.
create a content type in Modern SharePoint Online list
create a content type in the Modern SharePoint Online list

Under the Parent Content type, there are two options presented they are,

  • Parent Category
  • content type

The below screenshot represents the options available for the Parent Category:

what are content types in sharepoint
create a content type in the Modern SharePoint list

The below screenshot represents the options available for the content type:

sharepoint online content types
create a content type in the Modern SharePoint list
  • In this example, I have selected the Parent Category as List Content Types and the content type as Item.
  • Select Create button to create a content type in the SharePoint list.
sharepoint list content types
create a content type in the SharePoint list

In the below screenshot, you can see the content type is created

create a content type in the SharePoint list
create a content type in the SharePoint list

We can see that the created content type was also added to the content type gallery as shown below:

create a content type to SharePoint list
create a content type for the SharePoint list

Now if we try to select the +Add column in the SharePoint Online list, we can able to see the created content type. Select the content type as mentioned below:

create a content type for the SharePoint Online list
create a content type for the SharePoint Online list

Now, we can choose the content type that was created, Select the content type that you want to add to the SharePoint Online List, and click on the Apply button. And the content type will be added to the SharePoint Online list.

create a content type for SharePoint Online list
create a content type for the SharePoint Online list

In the below screenshot you can see that the content type is added for the SharePoint Online list items. Now we can add new items to the Created content type.

create a content type for the Modern SharePoint list
create a content type for the Modern SharePoint list
  • Here, you can see that we can select the content type and add items to the SharePoint list. By default, it displays the title columns, we can also add site columns in SharePoint Online list Content types.
create a content type for Modern SharePoint list
create a content type for the Modern SharePoint list

Follow the below to display the content type column in the SharePoint Online list

  • Expand the Column and click on the Column settings, and select the show/hide Columns option.
To display the content type column in the SharePoint Online list
To display the content type column in the SharePoint Online list
  • Now it will redirect to the edit view columns properties pane. Here we can select or choose the columns that we want to display in the SharePoint Online List view.
  • Now Select the Content Type column and click on the Apply to save your changes, so that they will reflect on your SharePoint online list.
To display the content type column in SharePoint Online list
To display the content type column in the SharePoint Online list
  • In the below screenshot, you can see that the content type column is added and displays the SharePoint Online list items content type.
  • We can also filter the list items based on the content types.
how to create content types in sharepoint online
To display the content type column in the SharePoint Online list

This is how to create content types in sharepoint online.

See also  SharePoint Online Code snippet web part

Read SharePoint Navigation – Add parent site navigation to a subsite in SharePoint

How to add Site Columns in SharePoint Online list content type

Let us see how can we add Site Columns in the SharePoint Online list content type,

  • Open the SharePoint Online List -> Select the Settings gear icon -> Click on the Site information -> then click on the view all site settings.
  • On the SharePoint site settings page, Select site content types under the Web Designer Galleries.
  • Now select the content type for which you want to add site columns in the SharePoint Online List.
add Site Columns in SharePoint Online list content type
add Site Columns in SharePoint Online list content type
  • Under the Site Columns, Expand +Add site column option. There are two ways that we can add site columns to the SharePoint Online list, They are,
    • Create a new site column.
    • Add from existing site columns.
add Site Columns in the SharePoint Online list content type
add Site Columns in the SharePoint Online list content type
  • Enter the Name of Site Column in the Name field, and the Description field is optional.
  • Under Category either we can choose an existing site content type category or we can create a new category.
  • In this example, I have selected existing category custom columns and Entered the Site Column name.
add Site Columns in the Modern SharePoint Online list content type
add Site Columns in the Modern SharePoint Online list content type

In the Select from column type option, choose the type of the site column that you want to create. In this example, I have selected the column type as a Choice column.

add Site Columns in Modern SharePoint Online list content type
add Site Columns in Modern SharePoint Online list content type
  • Enter the choices that you want to display, and +Add Choice if you want to add more choices.
  • Expand more options, and see more options like how to display the choices and how can we make the column required, etc.,
  • Select the Save button to create a site column in the SharePoint list.
add Site Columns in Modern SharePoint list content type example
add Site Columns in Modern SharePoint list content type example

In the below screenshot, you can see that the created Site column is added under the Site columns in the SharePoint list content type.

add Site Columns in SharePoint list content type example
add Site Columns in SharePoint list content type example

Now if we try to select the + New item in the SharePoint Online list, we can able to see the created Site Columns as below:

add Site Columns in Modern SharePoint Online list content type example
add Site Columns in Modern SharePoint Online list content type example
  • In the below screenshot, you can see that the Created Training Courses Available site column is added and displays the selected items.
  • We can also filter the list items based on the courses Available.
add Site Columns in the SharePoint Online list content type example
add Site Columns in the SharePoint Online list content type example

This is how we can add Site Columns in the SharePoint Online list content type

Read SharePoint Online Weather Web Part

Change the order of content types in a SharePoint list

Let us see how to change the order of a content type in the SharePoint Online List,

Yes, it is possible to change the order of a content type in the SharePoint list.

Before Changing the order of content types in a SharePoint list, Make sure you have enabled the allow management of content types in the SharePoint list settings page. if you didn’t enable it, then follow the below steps:

Follow the below steps to enable allow management of content types in the SharePoint list,

  • Open the SharePoint Online List and select the Settings gear icon and click on the List Settings.
enable allow management of Content Types in Modern SharePoint
enable Allow management of Content Types in Modern SharePoint
  • On the list settings page, Under General settings, click on the Advanced settings option as shown below:
enable allow management of Content Types in the Modern SharePoint
enable Allow management of Content Types in the Modern SharePoint
  • On the Advanced settings page, In the Content types enable Allow management content types to Yes for the SharePoint List.
  • Scroll down on the same page, and select the Ok button to commit your changes.
sharepoint allow management of content types
sharepoint allow management of content types

In the below screenshot, you can see that the content type is added to the SharePoint List Settings Page.

enable allow management of Content Types in the SharePoint Online
sharepoint allow management of content types

This is how to enable allow management of content types in the SharePoint list.

See also  SPFx - Bind dropdown list from SharePoint list using PnP

Now we will see how to change the order of the content types in the SharePoint list, In this example, you can see the default item content type in the first place and the Developer Training content type in the Second Place.

Change the order of a Content-type in the Modern SharePoint list
Change the order of a content type in the Modern SharePoint list

Follow the below steps to change the order of a content type:

  • Open the SharePoint Online List -> Select the Settings gear icon -> click on the List Settings.
Change the order of a Content type in Modern SharePoint list
Change the order of a content type in the Modern SharePoint list
  • On the list settings page, Under Content types, click on the Change new button order and default content type option as shown below:
Change order of a Content type in Modern SharePoint list
Change the order of a content type in the Modern SharePoint list
  • On the Change New Button order settings page, In the content type order, change the Position based on the content type, and select the number from the drop-down.
  • Uncheck the check box, if you don’t want to display any of the content types.
  • Click on the Ok button, to save your changes.
Change the order of a Content type in the Modern SharePoint list example
Change the order of a content type in the Modern SharePoint list example

Now, navigate to the SharePoint Online list and check the order of the content type, that will be changed.

In the below screenshot, you can see the Developer Training content type in the first place and the default item content type in the Second Place.

content types sharepoint
Change the order of a content types in the Modern SharePoint list example

This is how to change the order of a content type in the SharePoint Online List.

Read SharePoint Online Code snippet web part

Remove content type from SharePoint site

Let us see how we can delete a SharePoint Online List Content type from the SharePoint site,

  • Open the SharePoint Online List -> Select the Settings gear icon -> Click on the Site information -> then click on the view all site settings.
  • On the SharePoint site settings page, Select site content types under the Web Designer Galleries.
  • Now select the content type in the content type gallery that you want to delete from the SharePoint Online List.
  • Click on the delete option, it will remove the content type from the SharePoint List.
  • Once we delete the selected content type from the SharePoint site, it will get deleted for all the SharePoint Online lists which are using the Selected content type.

In this example, I have selected the training course Collection content type. For example, if we use the Training course collection for many SharePoint Online lists, it will get deleted from all SharePoint Online lists.

sharepoint content type
sharepoint content type
  • In the Confirmation box, select the delete option to delete the content type.
  • Once deleted, we cannot restore the content type. We don’t have an option to restore the deleted content type.
sharepoint list content types
Delete a SharePoint Online List Content type
  • In the below screenshot, you can see the item didn’t get deleted because the content type is used in the SharePoint Online list.
  • We cannot delete the in-use Content types and Read-only from the SharePoint site.
sharepoint online content types
Delete SharePoint Online List Content type from Modern SharePoint site example

This is how to delete a SharePoint Online list content type from a SharePoint Online site.

Read SharePoint Online Divider and Spacer Web Part

View all SharePoint Content Types

If you want to check all the SharePoint content types, follow the below steps.

In a SharePoint site, you can access the content type from the URL directly:

https://mypc/sites/MySP2016SiteCollection/_layouts/15/mngctype.aspx

This will be the same for the SharePoint Online site as well:

Ex: https://tsinfo.sharepoint.com/sites/TSInfoClassic/_layouts/15/mngctype.aspx

Or we can access it from the Site Settings page -> then click on Site content types which are under Web Designer Galleries.

Here you can see all the site content types below:

content types in sharepoint
sharepoint list content type

You can also filter based on the content type group. Like you can filter list content types like below:

sharepoint list content type
content types in sharepoint

When you add a content type to the content types gallery of a specific site, that content type is available for use within the current site, as well as in all the child sites in the site hierarchy below it.

When you add a content type to the content types gallery of a top-level site, it is available for use throughout the entire site collection.

SharePoint automatically adds a standard set of content types to the content types gallery of every top-level site.

Read SharePoint Online List Permissions

Default SharePoint Content Type ID

Each SharePoint content type has a unique id. Below you can see the content type id for the default SharePoint content types.

IDNameParent
0x01ItemSystem
0x0101DocumentItem
0x0102EventItem
0x0104AnnouncementItem
0x0105LinkItem
0x0106ContactItem
0x0108TaskItem
0x0120FolderItem
0x010101FormDocument
0x010102PictureDocument
0x010105Master PageDocument
0x010108Wiki PageDocument
0x010109Basic PageDocument
0x012002DiscussionFolder
0x012004Summary TaskFolder
   

Read SharePoint Online sites web part

How to get Content Type Id of SharePoint list or library

Now, we will see how to get the content type id of a SharePoint list or library. We can get the SharePoint content type id from the browser itself.

Open your SharePoint list and then click on “List Settings” from the Ribbon. Then from the List Settings page click on “Advanced Settings“.

See also  How to Create Content Type in SharePoint using Power Automate

In the Advanced Settings page, from the Content Type section choose the Yes radio button in the Allow management of content types? like below as shown in the fig below:

content type in sharepoint
content type in sharepoint

Then in the List Settings page go to the Content Types section and click on Item content type as shown in the fig below:

How to get Content Type Id of SharePoint 2016 list?
content type in sharepoint

Now check the URL now, in the right hand side after &ctype=0x010032D64F8BA70EFD4E80E10DB038691A87 is the content type id like below:

what is content type in sharepoint
sharepoint content types

This is the final content type id of the particular SharePoint list or library. This will work for SharePoint Online sites.

Remove content type from sharepoint list

Let us see, how to delete the content type from SharePoint list using Powershell in SharePoint 2013/2016/2019 or SharePoint Online.

Also, we will resolve the error which comes while trying to delete the content type from the SharePoint list. The error comes as Another site or list is still using this content type. If you would still like to delete it, please remove the content type from all sites and lists and then try again.

The error will look like the below:

delete content type from list powershell sharepoint
delete content type from list powershell sharepoint

Delete or remove the content type from the SharePoint list

There are different types of solutions to fix this issue. 1st we need to remove all content types which is associated with the list. We can use PowerShell, PnP PowerShell, or manually remove the content type from the SharePoint List.

Powershell command to remove the content type from List in SharePoint

Below is the PowerShell script to remove the content type from list in SharePoint. If you are new to PowerShell in SharePoint, check out the PowerShell SharePoint tutorial.

$siteURL = "The Site url"
$contentType = "Content type Name"
$web = Get-SPWeb $siteURL
$ct = $web.ContentTypes[$contentType]
if ($ct) {
$ctusage = [Microsoft.SharePoint.SPContentTypeUsage]::GetUsages($ct)
foreach ($ctuse in $ctusage) {
$list = $web.GetList($ctuse.Url)
$contentTypeCollection = $list.ContentTypes;
$contentTypeCollection.Delete($contentTypeCollection[$ContentType].Id);
Write-host "Deleted $contentType content type from $ctuse.Url"
}
$ct.Delete()
Write-host "Deleted $contentType from site."
} else { Write-host "Nothing to delete." }
$web.Dispose()

Delete content Type from list in SharePoint manually

We can also delete the content type one by one by the manual procedure from the list settings page in SharePoint. Before deleting, we need to find the references in which list it exactly used then delete it one by one.

delete content type from list powershell sharepoint
delete content type from list powershell sharepoint

PNP PowerShell script to Delete Content Type in SharePoint Online

We can also use PnP PowerShell in SharePoint Online to delete content type from the SharePoint list.

#Config sitename
$SiteURL = "https://pikasha12.sharepoint.com"
$ContentTypeName ="Name of your content Type"
 
#Connect to PNP Online SharePoint
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
 
#Get the content type
$ContentType = Get-PnPContentType -Identity $ContentTypeName
 
If($ContentType)
{ 
    Remove-PnPContentType -Identity $ContentTypeName -Force
}

Once your script will execute successfully next check your page. If still error appears on your page then follow the points below.

  • Delete from site recycle bin.
  • Delete from Site Collection > Site Settings > Site Collection Administration > Recycle Bin.
  • Delete from End User Recycle Bin Items.
  • Delete from “Deleted From End User Recycle Bin.”

Another site or list is still using this content type

Here is another solution for, Another site or list is still using this content type. if you would still like to delete it, please remove the content type from all sites and lists and then try again.

Recently for one of our custom visual studio workflow requirements, we created few content types (inherited from Workflow Task (SharePoint 2013) content type). We have used these content types in our task list on various sites and subsites.

Now when we try to delete the content types we got the below error:

Sorry, something went wrong.

Another site or list is still using this content type. If you would still like to delete it please remove the content type from all sites and lists and then try again

SharePoint online Another site or list is still using this content type
SharePoint online Another site or list is still using this content type

Another site or list is still using this content type

We have removed the content types from the attached SharePoint list. And then we removed the items from the recycle bin too. But still, it was showing the same error.

The above exercise we have in all the lists and libraries from the sites and also from the subsites. But still, it was showing the error.

Then I noticed, that we have created two items by using the content type in one of our task lists.

Another site or list is still using this content type
Another site or list is still using this content type

When we delete the above items from the list, I can able to delete the content types from the SharePoint list.

This is how to delete the content type from SharePoint list using PowerShell or PnP PowerShell.

Also, we saw, how to fix errors, another site or list is still using this content type. if you would still like to delete it, please remove the content type from all sites and lists and then try again.

In this SharePoint tutorial we have learned, What is the SharePoint online list content type and How we can enable allow management of Content Types to yes in the SharePoint List. And also covered the below-mentioned topics:

  • How to create a SharePoint Online list content type
  • How to add Site Columns in SharePoint Online list content type
  • Change the order of a content type in the SharePoint Online list
  • Delete SharePoint Online List Content type from the SharePoint site
  • remove content type from sharepoint lis

You may like the following SharePoint Online tutorials:

>