Error when trying to delete a page layout in MOSS: This item cannot be deleted because it is still referenced by other pages

Today I ran into an error while creating page layouts using a feature. I made a mistake in the XML that provisions the files to install with the feature for my page layouts. My problem was an incorrect value in the attribute for the content type ID linked to my installed page layout.

After realizing my mistake and correcting it, uninstalling the feature and reinstalling it again the original incorrect page layout was still installed. This seems to be normal in SharePoint. Even when deactivating and uninstalling a page layouts feature these pages still stay in the "Master Page and Page Layout Gallery". I still have to find the right documentation on why this happens but I imagine it has to do with ghosting of the pages.

Now back to my problem. Since the incorrect page layout was still installed and giving me error messages I tried to delete it manually from the gallery. This gave me the following error message:

"This item cannot be deleted because it is still referenced by other pages"

Even if this is not the case (there was no page using this page layout), the problem is mentioned in the following KB article:

http://support.microsoft.com/?kbid=926812

The KB proposes to change the properties of the master page to Hidden. This workaround did not solve my problem since everytime I tried to access the page layout's Properties screen I got another error message due to my mistake discussed above.

There was however one workaround that solved the problem:

  1. Create a new sub-folder in the master page gallery
  2. Move the page layout to the new folder (I did this by using SharePoint Designer)
  3. In the MOSS interface, delete the complete folder by using the dropdown menu.

Yep, my page layout is finally gone from the gallery!

While my problem was specific to a page layout I think the same solution will work with master pages as well.

Technorati tags:

WCM resources - MOSS 2007

Web content management is a new feature in Sharepoint (MOSS 2007). These are my most important resources for getting information on WCM:

There are also some other tools I like using when developing WSS/MOSS, I'll post these another day.


Welcome to my blog

I decided to start blogging about what occupies me most part of the week: developing in Microsoft .NET technologies.

I'm currently implementing my first project in Microsoft Office server 2007 (Sharepoint), so my first posts will probably be about it.
Even if I call the blog All about .NET I'l probably throw in some other stuff as well.

Katrien

Copyright © 2007 Katrien De Graeve.