[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)
[System.Reflection.Assembly]::LoadWithPartialName(“System.Xml”)
$webApp=[Microsoft.SharePoint.Administration.SPWebApplication]::Lookup(“http://servernam
e”)
foreach($site in $webApp.Sites)
{
$web=$site.RootWeb
$file=$web.GetFile(“MyWebPartPage.aspx”)
if($file.Exists)
{
$wpManager=$web.GetLimitedWebPartManager(“Default.aspx”,[System.Web.UI.WebControls
.WebParts.PersonalizationScope]::Shared)
foreach($webPart in $wpManager.WebParts)
{
if($webPart.GetType().Name -eq “myContentEditorWebPart”) -> Getting my ContentEditor
WebPart.
{
$wp=[MicroSoft.SharePoint.WebPartPages.ContentEditorWebPart]$webPart
}
}
}
}
No comments:
Post a Comment