Get web part object with properties

21/10/2012 14:14


$assembly=[void][reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint.Publishing, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
#you have to get the web, where is your web part
 $site = Get-SPSite -Identity $serverUrl
 $web = $site.RootWeb
 #initialize the webpart-manager and locate it to the page
 $webpartmanager = $web.GetLimitedWebPartManager("https://fastlanessl/Pages/default.aspx", [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
 #see list of web parts on the page
  #see selected web part on the page
  $webpart = $webpartmanager.WebParts[0]
  #see selected web part properties (web browsable)
  #$webpart|format-table #use from command line
  #see concrete property value of wp (e. g.'ConfigurationListuGuid' property)
  $webpart.ConfigurationListGuid (#this is custom web browsable property)