Thursday, 21 March 2013

Copying pages from one site collection to another

So you want to move content pages from one site collection to another? 

Easy! Just open the pages library in explorer view copy the page/s you want to move and paste them to the destination pages library once again using explorer view.


Invalid page layout errors!


SharePoint hard codes the page layout location URL within the .aspx page.

How do I fix this?

A) You could write some powershell using the SP object model to copy files.


B) You could download the ASPX page locally, manually edit the Page Layout URL and then upload the page to the new pages library.

The problem I had was not having any access to central admin powershell. So with great apprehension chose option B.


I had about 175 pages to move and to open, edit and save 175 pages individually was just not feasible. So I went old school. How many of you remember Windows GREP? What this small utility does is it allows you to search and replace strings within an entire folder.


PS option B works!


  1. Worth keeping in mind that any people fields on your pages will end up mapped to different people if you do it using option B!

    The underlying data for these fields is the ID of the user in the site collection, so unless your users were added to both site collections in exactly the same order, your pages will end up with different people references.

    1. This is true. Not a great idea if audit trails are important to you - in fact not an option at all!

      In my case this was fine as we were still in a QA environment and all the pages had been migrated using script so all the people fields were populated by a system account.

    2. And also, being in QA we only had a handful of users added to the web app anyway, so it was no problem in this scenario.