It happens when you have a problem with a webpart in one of your SharePoint environments in need to debug to see what are the properties of this webpart, this PowerShell script can help:
#Add-PSSnapin Microsoft.SharePoint.PowerShell
$SiteUrl = "http://www.yoursite.com"
$pageURL = "Pages/default.aspx"
$site = New-Object Microsoft.SharePoint.SPSite($SiteUrl)
$psite = New-Object Microsoft.SharePoint.Publishing.PublishingSite($site)
$web = Get-SPWeb $SiteUrl
$pweb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
$wpm = $web.GetLimitedWebPartManager($pageURL, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
#List all the web parts
$wpm.WebParts | ft
#Get the details of the first web part
$wp = $wpm.WebParts[0]
$wp
#Add-PSSnapin Microsoft.SharePoint.PowerShell
$SiteUrl = "http://www.yoursite.com"
$pageURL = "Pages/default.aspx"
$site = New-Object Microsoft.SharePoint.SPSite($SiteUrl)
$psite = New-Object Microsoft.SharePoint.Publishing.PublishingSite($site)
$web = Get-SPWeb $SiteUrl
$pweb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
$wpm = $web.GetLimitedWebPartManager($pageURL, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
#List all the web parts
$wpm.WebParts | ft
#Get the details of the first web part
$wp = $wpm.WebParts[0]
$wp
No comments:
Post a Comment