SharePoint Online: Change Column Order in List using PowerShell

Requirement:  Change Column Ordering in SharePoint Online List.

How to Change the Column Order in SharePoint Online?

When you create a SharePoint Online list, the columns are automatically added in the order they were created. In some cases, you may need to change the column order. Maybe you’ve added a new column and want it to appear first, or you just want to tidy up the display. This article will show you how to change the column order in the SharePoint Online list.

To change the order of columns in a SharePoint Online list or library, do the following:

  1. Navigate to the list or library where you want to reorder the columns.
  2. Click on Settings gear >> list or library settings
  3. On the List or Library Settings page, click the “Column Ordering” link under columns.
  4. On the change column ordering page, set the position of columns from drop-down values for the listed columns in the desired order.
    change column order sharepoint online
  5. Once all columns are in the desired order, click the OK button to save the order.

Please note, The column order does not affect the order of columns in the list or library views! Only New, Edit, and View Properties, or the property pane, gets these changes. To reorder fields in the list view, You have to edit the view and set the order of columns.

PnP PowerShell to Change Column Order in SharePoint Online

Here is how to change column order in SharePoint Online using PowerShell:

#Set Variables
$SiteURL = "https://crescent.sharepoint.com/sites/projects"
$ListName = "Projects"

#Set Order of Fields - By its Internal Name
$FieldOrder = @("Title","Description","StartDate", "Project_x0020_Start_x0020_Date","Project_x0020_Status", "Department")
 
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
 
#Get the default content type from list
$ContentType = Get-PnPContentType -List $ListName | Select  -First 1
 
#Update column Order in default content type
$FieldLinks =  Get-PnPProperty -ClientObject $ContentType -Property "FieldLinks"
$FieldLinks.Reorder($FieldOrder)
$ContentType.Update($False)
Invoke-PnPQuery 

If you want to set the column order in content types of the SharePoint Online list, use: SharePoint Online: Change Column Order in Content Type using PowerShell

Conclusion

In conclusion, changing the column order in SharePoint Online allows you to rearrange the columns in a list or library to better suit your needs. You can use the SharePoint Online UI or PowerShell to change the column order. Using the SharePoint Online UI, you can navigate to the list or library settings, select the column you want to move, and use the “Move Up” or “Move Down” button to change its position. Using PowerShell, you can use the Reorder() method to move the column to the desired position, and Update() method to save the changes. Organizing columns in a logical order can make it easier for users to find and process the information they need, thus improving overall productivity.

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 *