- Add-PSSnapin Microsoft.SharePoint.PowerShell
- $webURL = Read-Host "Please enter your SiteCollection Url"
- $spSite = New-Object Microsoft.SharePoint.SPSite($webURL)
- $web = $spSite.OpenWeb()
- $list = $web.Lists["Customer"]
- Write-Host “Updatiing Category field values' for:- ” $list.Title -ForegroundColor Yellow
- $CategoryField = $list.Fields["Categories"];
- $ChoicesArray = @("Product related","Production"," (HR)"," Code of Business Conduct","Sustainability");
- #remove old values
- $CategoryField.choices.clear()
- #update new values
- $CategoryField.choices.addrange($ChoicesArray)
- $CategoryField.Update()
- Write-Host “Category field value updated successfully” -ForegroundColor Green
- $web.Dispose()
- Remove-PSSnapin Microsoft.SharePoint.PowerShell
This code snippet for Update choice field multiple value using powershell script in SharePoint.
