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,



The Page Layout Button is Disabled on the Ribbon

SharePoint 2010 has a bug on the ribbon for the publishing site. In some pages the Page Layouts button is disabled on the ribbon.

A simple workaround for this can be found at

-Check the page out and edit it.

-Click on the Save and Close dropdown and select Save and Keep Editing.

-After the page is refreshed you will see the Page Layouts button enabled.

Thanks Erik Swenson! It helped me a lot!!


See you,