How can we retrieve all the choice values in the choice field using powershell CSOM
i hardly could not find any resources for this functionality
any help would be appreciated
How can we retrieve all the choice values in the choice field using powershell CSOM
i hardly could not find any resources for this functionality
any help would be appreciated
You can use the PowerShell command below:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$WebURL="http://intranet.crescent.com/"
$ListName ="Projects"
$MultiChoiceFieldName="Category"
$Web = Get-SPWeb $WebURL
$List = $Web.lists.TryGetList($ListName)
#Get the 1st item stored in the list
$Item = $List.items[0]
#Get the multiple choice field
$MultiChoiceValues = New-Object Microsoft.SharePoint.SPFieldMultiChoiceValue($Item[$MultiChoiceFieldName])
#Print Each Value
For($I=0; $I -lt $MultiChoiceValues.count; $I++)
{
write-host $MultiChoiceValues[$I]
}
Reference: Get-Set Choice Field Value in SharePoint using PowerShell