Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

PowerShell PnP sort SharePoint choice column

$
0
0

We are using this below script to add new values to our choice column, but need the option to sort the SharePoint list column choice values ascending. There are over 150 values, and just putting new values on the end/bottom of the dropdown isn't user friendly.

Connect-PnPOnline-Url"https://MySite/sites/Sandbox"-UseWebLogin
$field =Get-PnPField-List aaa-f31e-4cc0-b193-bbb -IdentitySchedule[xml]$schemaXml = $field.SchemaXml

$varNewChoice = $schemaXml.CreateElement("CHOICE")
$varNewChoice.InnerText="Thursday"
$schemaXml.Field.CHOICES.AppendChild($varNewChoice)Set-PnPField-List aaa-f31e-4cc0-b193-bbb -IdentitySchedule-Values@{SchemaXml=$schemaXml.OuterXml}


Viewing all articles
Browse latest Browse all 7589

Trending Articles