The Page Cannot be switched to Another Page Layout

November 26, 2013

I'm currently working on a migration project at a client. It's a migration from SharePoint 2010 to 2013, which involves some re-development and branding. For the branding part, where this post focusses on, a couple of new page layouts needed to be created. The purpose of these page layouts is to replace the old versions, and to move from five almost completely the same page layouts to only one page layout.

Last week I was at the point of provisioning the new page layout and doing the remapping of the old ones. All went very smoothly with a PowerShell script at first sight, but checking the pages, I saw a problem with a specific custom site template. On these sites, the pages were still using the old page layouts. Although the new page layout was linked to that page item. I tried to do the remapping again via code and from the UI, but neither worked. The reference to the page layout were set up correctly, but the page itself kept using the old page layout.

The next thing I did was opening the site templates project and the pages were provisioned correctly, but the next step that caused the problem. When the page was provisioned, the person that created that solution, provisioned the web parts on the page by overwriting the page content itself. Due to this, the page references were gone, and the page layout couldn't be switched.


The solution I tried, which also worked, was detaching the page layout from the page and reattaching it again. This method was something I hadn't used for quite a long time.

You can easily test this by opening your site in the good "old" SharePoint Designer, navigate to the library, and right click on the page that's causing the problem. There you'll find the option to detach the page layout: Detach from Page Layout.

Detach from Page Layout

Detach from Page Layout

After that the option will be switched to Reattach to Page Layout:

Reattach from Page Layout

Reattach from Page Layout

In my case I had to do this on a lot of sites and pages. So I created a PowerShell script for it to fix it.

Note: change the site and page layout references to that of your environment.