SharePoint Online: Change Content Type Order in New Menu using PowerShell

Requirement: Change content type order in SharePoint Online List using PowerShell

How to Change Content Type Order in SharePoint Online List or Library?

In a SharePoint Online list with multiple content types, you may want to change the order they appear in the “New” menu or even want to hide them from the new button.
sharepoint powershell content type order
Well, You can specify the order and set which of the available ones appear there. To manage content type settings, do the following:

  1. Navigate to the SharePoint Online list or library where content types need to be managed.
  2. Go to List or Library Settings >> On the Settings page, Click
    on “Change New Button Order and Default Content Type” link under Content
    Types section.
  3. On the Change New Button Order page, You can reorder available content types, enable or disable them from appearing in the new menu by setting visibility check box. Content type which appears at first position becomes the default content type for the list.
    sharepoint online change content type order powershell
  4. Click the OK button to save the changes.

PowerShell to Change Content type Order in SharePoint Online

Here is the PowerShell script to change the order of content types in SharePoint Online list or library.

#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"
#Set Variables
$SiteURL= ""
$ListName = "Contacts"
$ContentTypesOrder = @("Contact", "Item", "Announcement")

#Setup Credentials to connect
$Cred = Get-Credential
Try {
    #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 List
    $List = $Ctx.Web.Lists.GetByTitle($ListName)

    #Create a List for content types order
    $ContentTypeOrder = New-Object System.Collections.Generic.List[Microsoft.SharePoint.Client.ContentTypeId]

    #Arrange Content Types Order
    ForEach($ContentType in $ContentTypesOrder)
        #Get the Content Type from List and Add to Content Type Order List
        $CType = $List.ContentTypes | Where {$_.Name -eq $ContentType}
        If($CType -ne $Null)
    #Set Content type Order
    $List.RootFolder.UniqueContentTypeOrder = $ContentTypeOrder
    Write-host -f Green "Content Type Order has been updated Successfully!"#>
Catch {
    write-host -f Red "Error: " $_.Exception.Message

Please note, this script doesn’t remove or re-add any content types from the list, it simply changes the order of content type sequence. Content type in the first index becomes the default content type.

To hide a content type from New menu, just leave its name in $ContentTypesOrder variable!

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply