SharePoint Online: Change the Column Order in Content Type using PowerShell

Requirement: Change Column Order in SharePoint Online Content Type using PowerShell

How to Change the Column Order in SharePoint Online Content Type?

The column order in SharePoint Online content types defines the order of fields displayed in list forms such as New, Edit, and View pages. To change the order in which the columns associated with a content type are displayed on list pages, do the following:

  • Navigate to the SharePoint Online site where the content type was created.
  • Click on Settings gear >> Select Site Settings
  • On the Site Settings page, select the “Site Content Types” link under the “Web Designer Galleries” section.
  • On the Site Content Types page, click on the name of the content type to be edited >> Click the “Column Order” link from the Columns section.
  • On the Column Order page, You can change the position from top numbers to set the sort order for the columns.
    sharepoint online change column order in content type powershell
  • Once done, Set whether the column ordering changes to be pushed to all content types based on this type.
  • Click the OK button to save the changes.

This sets the column order for a list content type at the list level. Column order can be set for both list content types and site content types.

SharePoint Online: PowerShell to Set Content Type Column Order

How about re-arranging fields in 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"
#Set Variables
$SiteURL= ""
$ListName = "Contacts"
$ContentTypeName = "Announcement"
$ColumnOrder = @("Title", "Category", "Body", "Expires")

#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 Content Type
    $List = $Ctx.Web.Lists.GetByTitle($ListName)

    #Get the Content Type from List
    $CType = $List.ContentTypes | Where {$_.Name -eq $ContentTypeName}
    If($CType -ne $Null)

        #Set Content type field Order
        Write-host -f Green "Content Type Order has been updated Successfully!"
Catch {
    write-host -f Red "Error: " $_.Exception.Message

Change Column Order in Content Type using PnP PowerShell

Let’s change the column order in site content type using PnP PowerShell.

#Set Variables
$SiteURL = ""
$ContentTypeName ="Crescent Project Proposal V2"
$FieldOrder = @("Project_x0020_Name","Project_x0020_Description","Project_x0020_Start_x0020_Date","Project_x0020_Status","Project_x0020_Manager")

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)

#Get the content type
$ContentType = Get-PnPContentType -Identity $ContentTypeName

#Update column Order in content type
$FieldLinks =  Get-PnPProperty -ClientObject $ContentType -Property "FieldLinks"

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 *