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.

Nope.

Invalid page layout errors!

Why?

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.

or 

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 so....no powershell. So with great apprehension chose option B.

BUT...

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.

Result!

PS option B works!