Friday, June 28, 2013

Uncheck SharePoint 2010 Site Column type checkbox using Powershell

$site = New-Object Microsoft.SharePoint.SPSite("yoursiteurl")
$web = $site.openweb("")

$Library = "working documents"$DocLib = $web.lists[$Library]

Write-Host "title"  $DocLib

foreach ($item in $DocLib.items)
{

if($item["ARCHIVED"]) #if it is checked (Archived is a site col)
{
      write-host "Archived:"  $item["ARCHIVED"] $item.title       $item["ARCHIVED"] = "0" #Uncheck the checkbox
      $item.Update()
      write-host "Archived:" $item["ARCHIVED"]
}

}


$web.dispose()
$site.dispose()


No comments:

Post a Comment

Followers