Tuesday, August 20, 2013

SharePoint 2013 migration issue with javascript only content editor webpart breaking the webpart page and closes the browser

Here is a simple script to output the contents of the CEWP to be ran on the 2010 environment to investigate the potential issues you might encounter for javascript only CEWP when it gets migrated to 2013.


$siteUrl = "http://localhost"
$site = Get-SPSite $siteUrl
$cewpCount = 0
$cewps = New-Object Hashtable
$site.AllWebs | % {

     $pageUrl = $_.RootFolder.WelcomePage;
     $pageUrlFull = ($_.Url + "/" + $pageUrl);
     if($pageUrl.Length -gt 0 )
     {
       $parts = $_.GetWebPartCollection($pageUrl, 2)
         $parts | ? { $_.WebBrowsableObject.ToString() -eq "Microsoft.SharePoint.WebPartPages.ContentEditorWebPart" } | % {
         $ce = [Microsoft.SharePoint.WebPartPages.ContentEditorWebPart]$_
         Write-Host "Found on Page URL: " $pageUrlFull $_.StorageKey $ce.Title -ForegroundColor Green
          Write-Host $ce.Content.InnerText
          $cewpCount += 1;
          $cewps.Add($_.StorageKey, $pageUrlFull); }
      }    
    }
          
Write-Host "Found" $cewpCount "CEWPs" -ForegroundColor Green




No comments:

Post a Comment