SharePoint Online: Enable Content Types using PowerShell

As the name suggests, content type defines the type of content, such as an item or document. In a real-world scenario, A content type could refer to an invoice template, project plan document, etc. Content types provide an effective method of grouping relevant columns (metadata), document templates, workflows, and policies together and help to standardize a template for reuse. Typically, content types are created at the top-level site, as they are hierarchical in nature. In other words, a content type created at the root site gets inherited to all its subsites automatically. This saves a lot of time as you need to create that content type only once and reuse it wherever required.

How to Enable Content Types in SharePoint Online?

Before adding content types to a list or library, We must enable content type management in list or library settings. To enable content type in the SharePoint Online list, follow these instructions step-by-step:

  1. Navigate to the List >> Settings >> List Settings >> Advanced Settings.
  2. Set “Yes” for “Allow management of content types?” and hit OK button to save your changes.
    enable content types in sharepoint online

If you go back to list settings, you’ll find a section called “Content Types” with the particular list or library’s default content type listed (E.g., Item for the custom list!). You can add any existing content types to the list now!

PowerShell to Enable Content Types in SharePoint Online List using PowerShell

If you are a SharePoint Online user, you may need to enable content types from time to time, which can easily be done using PowerShell. Let me show you how to use PowerShell in SharePoint Online to enable content types:

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#function to turn ON Content Type in SharePoint Online list or library
Function Enable-ContentTypes()
        [Parameter(Mandatory=$true)] [string] $SiteURL,
        [Parameter(Mandatory=$true)] [string] $ListName

    Try {
        $Cred= Get-Credential
        $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)

        #Setup the context
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
        $Ctx.Credentials = $Credentials
        #Get the List object
        $List = $Ctx.Web.Lists.GetByTitle($ListName)

        #Check if content types are already enabled
        If($List.ContentTypesEnabled -eq $True)
            Write-host "Content Types Already Enabled in the given List!" -ForegroundColor Yellow
            #enable content types in the list

            Write-host "Content Types Enabled for given List Successfully!" -ForegroundColor Green  
    Catch {
        write-host -f Red "Error enabling Content Type!" $_.Exception.Message

#Set parameter values

#Call the function
Enable-ContentTypes -SiteURL $SiteURL -ListName $ListName

This can be helpful if you need to quickly enable a content type for a specific list or library, or if you want to disable a content type.

PnP PowerShell to Enable Content Type on a SharePoint Online List:

You can also use PnP PowerShell to enable content types in a list. This can be helpful if you want to customize the list’s functionality or if you need to create a new content type and add it to the list. Let me show you how to use PowerShell to enable content types in a SharePoint Online list:

#Config Variables
$SiteURL = ""
$ListName = "Projects"

#Connect to Site collection from PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive

#Enable Content Type
Set-PnPList -Identity $ListName -EnableContentTypes $True

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

Leave a Reply

Your email address will not be published. Required fields are marked *