SharePoint Online: Hide a Content Type using PowerShell

Requirement: Hide a Content Type in SharePoint Online.

PowerShell to hide a Content Type in SharePoint Online:

If you want to keep certain content types hidden from your users, or if you need to remove a content type from use temporarily, You can hide that content type! This blog post will show you how to hide a content type using PowerShell.

#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"

#Config Parameters
$ContentTypeName="Business Contacts"

Try {
    #Get Credentials to connect
    $Cred= Get-Credential

    #Setup the context
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
    #Get the content type from the web
    $ContentTypeColl = $Ctx.Web.ContentTypes
    #Get the content type to Add
    $CType = $ContentTypeColl | Where {$_.Name -eq $ContentTypeName}
    If($CType -ne $Null)
        $CType.Group = "_Hidden"

        Write-host "Content Type Set Hidden!" -ForegroundColor Green
        Write-host "Content Type Doesn't Exist!" -ForegroundColor Yellow
Catch {
    write-host -f Red "Error Hiding the Content Type!" $_.Exception.Message

This moves the content type to the Hidden group – which hides the content type from the site settings >> Site Content Types page! Also, this content type will not be listed in the available content types dropdown when you try to add any existing content type to a list or library.

PnP PowerShell to Hide a Content Type in SharePoint Online

In some cases, you may want to hide a content type to prevent users from accidentally using it, or to streamline the user experience. Let’s see how to hide a content type in SharePoint Online using PnP PowerShell.

$SiteURL = ""
$ContentTypeName = "Crescent Contacts"

#Connect to SharePoint Online Site
Connect-PnPOnline -Url $SiteURL -Interactive

#Get the Content Type
$ContentType = Get-PnPContentType -Identity $ContentTypeName

#Hide the Content type
$ContentType.Group = "_Hidden"

To hide a content type from the new button drop-down in the SharePoint Online list settings page, use: SharePoint Online: Hide Content Type from dropdown

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

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