Skip to content

Instantly share code, notes, and snippets.

@jcallaghan
Last active February 24, 2017 16:28
Show Gist options
  • Save jcallaghan/17996432f3bd62e602ed96679c55bc9f to your computer and use it in GitHub Desktop.
Save jcallaghan/17996432f3bd62e602ed96679c55bc9f to your computer and use it in GitHub Desktop.
$wpManager = $file.GetLimitedWebPartManager([Microsoft.SharePoint.Client.WebParts.PersonalizationScope]::Shared)
$webparts = $wpManager.Webparts
$clientContext.Load($webparts)
$clientContext.ExecuteQuery()
if($webparts.Count -gt 0){
Write-Host "Looping through all webparts"
foreach($webpart in $webparts){
$clientContext.Load($webpart.WebPart.Properties)
$clientContext.ExecuteQuery()
$properties = $webpart.WebPart.Properties.FieldValues
Write-Host "Title: " $properties["Title"]
Write-Host "Chrome: " $properties["ChromeType"]
$webpart.WebPart.Properties["ChromeType"] = 2 # 0 title and boarder, 1 title, 2 none
$webpart.SaveWebPartChanges()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment