I have content editor,script editor, image viewer etc.. part on share point homepage. I am able to read the web part properties. Now i want to read the content or values of that web part using power shell.


You can use PnP for this. First you can get list of web parts on the page, then get the property of the web part you need using Get-PnPWebPart and Get-PnPWebPartProperty





$SPweb = Get-SPWeb($completeUrl)

$wpMngr = $SPweb.GetLimitedWebPartManager("SitePages/testttt.aspx",[System.Web.UI.WebControls.Webparts.PersonalizationScope]::Shared); #you could change the page
foreach($wp in $wpMngr.WebParts)
Write-Host $wp
Write-Host $wp.Content
Write-Host $wp.ImageLink
Write-Host "------------"

For different web part,we need to use different attribute to get the content.

Script Editor: $wp.Content

Image Viewer: $wp.ImageLink

Content Editor: $wp.ContentLink (As I test ,if we write code in cewp directly, we can not get the value)

  • For webpart Zone, ZoneId, ZoneIndex , how to add in the above code.
    – Liz
    Jun 3 '20 at 7:20
  • I just find Zone and ZoneIndex in the properties,just use $wp.Zone and $wp.ZoneIndex
    – Amos
    Jun 3 '20 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.