Error Moving CMS Pages on the Pages Library


When moving a CMS page to a subfolder on a Pages library using the Manage Content and Structure tool, the Content Managers were getting the following error:

System.ArgumentException – 0x80070057
at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)
at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)
at Microsoft.SharePoint.SPWeb.GetFileOrFolderObject(String strUrl)
at Microsoft.SharePoint.Publishing.CommonUtilities.GetFileFromUrl(String url, SPWeb web)
at Microsoft.SharePoint.Publishing.PublishingPage.get_Layout()
at Microsoft.SharePoint.Publishing.Internal.DeploymentWrapper.cachePageInfoForXmlFiltering(PublishingPage publishingPage)
at Microsoft.SharePoint.Publishing.Internal.DeploymentWrapper.configureExportCopyOrMove(String[] sourceSmtObjectIds, SPExportSettings& exportSettings, SPIncludeVersions versionsToInclude)
at Microsoft.SharePoint.Publishing.Internal.DeploymentWrapper.MoveItems(String[] sourceSmtObjectIds, String destSmtObjectId)
at Microsoft.SharePoint.Publishing.Internal.WebControls.MoveItems.Copy()

Operation to Move PageName.aspx to /Pages/SubFolder failed
After a little bit of research/thinking (yes, it doesn’t hurt a lot as some people imagine….lol) I recalled this site had been restored from a SharePoint farm in a different environment. So there was a chance the reference to the page layout was still pointing to the web application’s URL of the previous environment.

Fortunately, there are Powershell cmdlets created by Gary Lapointe we can use to solve this kind of issues. I just downloaded it, installed and made sure I got a fresh new Powershell window.

In the case I used the Repair-SPPageLayout cmdlet to fix all the references to page layouts. The syntax is:

Get-SPWebApplication “http://webapplicationurl” | Repair-SPPageLayoutUrl

This command repaired all the content pages which were not checked out. Then I tried the moving operation again and it succeeded.

 

See you,

Amadeu.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: