Skip to main content

Posts

Showing posts from January, 2017

Update Choice Field values through powerShell

Scenario: updating choice column option value for all the columns in a site collection including  sub sites. Solution ; Below script will iterate through all the sites and sub sites of site collection and finds the  choice column " choiceColumnName" and  will change the value "Choice 1" to "Option 1". Powerhsell Script: param($url = $(Read-Host -prompt "Root Site Collection Url")) #Get the PowerShell Snapin if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {     Add-PSSnapin "Microsoft.SharePoint.PowerShell" } #Get Root Site $root = Get-SPSite $url #If site was found / valid if($root -ne $null) {      foreach($subSite in $root.AllWebs)      {                  $subSiteTitle = $subSite.Title                 Write-Host $subSiteTitle -ForegroundColor Magenta                 $subSiteURL = $subSite.Url                 Write-Host $subSiteURL -Foregroun