0

I was messing around with my site and, in the process, accidentally removed everything from a page. This happened when I tweaked/deleted some web parts in the web part maintenance page (I also hit the reset button, but I'm not sure if that's the culprit). Although the page is completely blank, the maintenance page shows that the erased web parts still exist. This image shows the ones that I'm talking about:

The web parts in the blue box

Is there any way to restore those parts? Any help is appreciated.

1 Answer 1

0

That is very odd. The "Open on page" column shows your webparts are already on the page. Usually the issue is under that column they are not open, and you need to re-open (of which they show up under a special category in the webpart ribbon for closed webparts).

Check that you are not viewing the "personal view" of the page. If that is not the cause then I would disable all of those on the page and one by one start re-enabling them and testing the page output. If the first one fails - don't call it quits, disable it and try and different one first.

If you have access to the server you can try and export all your webparts and recreate the page.

Example PowerShell script courtesy Rada Tut

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

function EnsureDirectory($exportFolderPath)
 {
 if ( -not (Test-Path $exportFolderPath) ) {New-Item $exportFolderPath -Type Directory | Out-Null}
 }

function ExportAllWebParts($siteUrl,$pageUrl,$exportFolderPath)
 {
 $web = Get-SPWeb $siteUrl
 $wpm = $web.GetLimitedWebPartManager($pageUrl, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)

EnsureDirectory $exportFolderPath

foreach($wp in $wpm.WebParts)
 {
 $wp.ExportMode="All";
 $exportPath = $exportFolderPath + "\" + $wp.Title + ".xml"
 $xwTmp = new-object System.Xml.XmlTextWriter($exportPath,$null);
 $xwTmp.Formatting = 1;#Indent
 $wpm.ExportWebPart($wp, $xwTmp);
 $xwTmp.Flush();
 $xwTmp.Close();

}
 }
ExportAllWebParts $args[0] $args[1] $args[2]

# I use this script as a file, ExportWebParts.ps1. The required arguments for this script should be:
#The site absolute URL
#The page site-relative URL
#The folder path for export

#example usage ./ExportWebParts.ps1 http://spdevel.portal.com/Pages/default.aspx C:\temp\Export

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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