In a SharePoint Online Document library I have converted folders to document sets via PowerShell. However, the resulting document sets still have a value of "1" in the hidden and read-only SortBehavior ("Sort Type") column, which causes them to appear above documents sets that are created from the UI, as they are given the proper value of "0"

I've updated the SortBehavior's ReadOnlyField property to False and it appears that this update was successful. enter image description here

Despite this, I'm still unable to modify an item's SortBehavior property and any attempt to do so leads to the following error message:

Invalid data has been used to update the list item. The field you are trying to update may be read only.

Is there any approach that will allow an update to an item's SortBehavior value in SharePoint Online?

1 Answer 1


Please run the below PNP PowerShell to disable set a List Field to Read Only

Note: Please check the correct internal display name of the column.

#Config Variables
$SiteURL = "https://tenant.sharepoint.com/sites/sitename/"
$ListName = "listname"
#Internal Name
$ColumnName = "SortBehavior0"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
#Get the Context
$Context = Get-PnPContext
#Get the Field from List
$Field = Get-PnPField -List $ListName -Identity $ColumnName
#Set the Field to Read Only
$Field.ReadOnlyField = $false

enter image description here

enter image description here

  • EchoDu_MSFT, thank you very much for your reply. "SortBehavior" is a hidden and read-only, system generated lookup field in SharePoint and is what SharePoint uses in document libraries to sort folders to the top. "SortBehavior" is the internal name, "Sort Type" is the display name. Because it's hidden by default, it's not one of the fields you're able to see on the list/library settings page. Unfortunately, even after setting this field's ReadOnly property to False, I still receive the same error when trying to update it's value. Jul 7, 2021 at 17:50
  • Note, the pre-existence of this column is also why the column you named "SortBehavior" was internally renamed to "SortBehavior0". Jul 7, 2021 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.