I want to delete and add new choice fields in SharePoint Online list but only with PnP PowerShell.

Can you please suggest how to access choices of drop down field with PnP PowerShell?

1 Answer 1


We can modify the options of a choice field by modifying the schema xml of the field

Let say the field Fruit has 2 options, Apple and Orange and we want to add Banana to the list

First we get the schema xml of the field

$field = Get-PnPField -List 20559154-6a7e-4e67-b10b-a12bbc943152 -Identity Fruit
[xml]$schemaXml = $field.SchemaXml

The schema xml of the field should looks like this

<Field DisplayName="Fruit" FillInChoice="FALSE" Format="Dropdown" Title="Fruit" Type="Choice" ID="{98354d16-9929-4a1f-a97a-347694aaadad}" SourceID="{20559154-6a7e-4e67-b10b-a12bbc943152}" StaticName="Fruit" Name="Fruit" ColName="nvarchar4" RowOrdinal="0">

Then we may add the new choice, Banana, to the schema

$banana = $schemaXml.CreateElement("CHOICE")
$banana.InnerText = "Banana"

Finally we can update the schema xml of the field

Set-PnPField -List 20559154-6a7e-4e67-b10b-a12bbc943152 -Identity Fruit -Values @{SchemaXml=$schemaXml.OuterXml}

Now the field should have 3 options Apple, Orange and Banana in the list

Ref link - https://github.com/SharePoint/PnP-PowerShell/issues/1846

  • This works great, but is there a way to sort the values? Commented Jun 18, 2020 at 15:51
  • no direct way, make sure you add sorted values sequentially. Commented Jun 19, 2020 at 4:37

Your Answer

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

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