PowerShell Scripts to Manage Choice Field in SharePoint

PowerShell is a handy way to perform tedious and repetitive tasks in SharePoint. Say, we want to add or remove a choice value in a specific choice column for number of sites, etc.

Here are some nifty PowerShell scripts to manage choice field in SharePoint.

sharepoint powershell choice field

How to Add New Choice Field to SharePoint List using PowerShell?

Let’s use PowerShell to create choice column:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Define URL and List name variables 
$ListName ="Employee Profiles"

#Get the Web and Lists objects
$web = Get-SPWeb $WebURL
$List = $web.Lists[$ListName]

#sharepoint powershell to add choice field
$list.Fields.Add("Department", [Microsoft.SharePoint.SPFieldType]::Choice, $false)

#Add Choices to the field
$ChoiceField = $list.Fields.GetField("Department") #Get the field

#Commit changes

This PowerShell adds choice field.

SharePoint PowerShell to Add Choices to Choice Field

Choices can be added from arrays also. Here is how to add choices to the choice field using PowerShell

$ChoiceField = $list.Fields.GetField("Department") #Get the field
#Add in bulk - Array as Choices
$ChoicesArray = @("Marketing","Production","Operations","HR","IT")

#Commit changes

PowerShell to create choice column – Multi-Choice Field (Checkboxes)

#Choices for the column
$Choices = New-Object System.Collections.Specialized.StringCollection;

#Add Multichoice field
New fields added to SharePoint lists will not be included in default view by default! You have to add them explicitly.

Remove choices from the choice field:

#Get the choice field
$ChoiceField = $list.Fields.GetField("Department")

#Get all choices: 

#Remove a Choice from the column
#To remove all choices, use: 

#Commit changes to update choice column

Set Choice fields settings – SharePoint PowerShell to update choice field

We’ve added the choice field. Now, we can configure choice field settings via PowerShell.

#Get the Web and Lists objects
$web = Get-SPWeb $WebURL
$List = $web.Lists[$ListName]

#Get the choice field
$ChoiceField = $list.Fields.GetField("Department")

#Required Field?
$ChoiceField.Required = $true
#Set Default value
$ChoiceField.DefaultValue = "Operations"
#Allow Fill-in Choices
$ChoiceField.FillInChoice = $false
#Field format: such as radio button, drop down list
$ChoiceField.EditFormat = "RadioButtons"

#Commit changes

You may get error when the column is “Sealed”. Set it to “False” to perform any of the change/delete operations.

To check if a choice field is a multiple choice, use:  SPField.FieldValueType.Name -eq “SPFieldMultiChoiceValue”

For all supported properties of the choice field in SharePoint, refer SPFieldChoice reference in MSDN. To get choice field value or set choice field value using PowerShell, refer to How to Get or Set Choice field values using PowerShell?

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!

4 thoughts on “PowerShell Scripts to Manage Choice Field in SharePoint

  • Can I Change Choice Field Type from Radio button to Check Boxes?

    • Sure, Here is the Script:
      $Field = $List.Fields.GetFieldByInternalName($FieldInternalName)
      $Field.Type = [Microsoft.SharePoint.SPFieldType]::MultiChoice

  • Hello,

    Please Sir, if I want to have a drop down list of choice and the field must be Required! what should I modify here :



    • Here is Syntax:
      public string Add(
      string strDisplayName,
      SPFieldType type,
      bool bRequired,
      bool bCompactName,
      StringCollection choices
      So, use: $list.Fields.Add(“Department”,[Microsoft.SharePoint.SPFieldType]::MultiChoice,$True,$False,$Choices)


Leave a Reply

Your email address will not be published. Required fields are marked *