Thursday, 1 October 2009

“This item cannot be deleted because it is still referenced by other pages” and “There is no file with url” errors when trying to delete a master page in MOSS 2007

I tried to delete a custom master page in MOSS 2007 and it gave me the following message:

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

Microsoft published a workaround for this here, which suggests hiding the master page, but I needed to replace it with a new one and hiding it didn’t seem like a good idea to me. So, I thought I’d try and delete it in SharePoint Designer, which showed exactly the same message as the browser UI. I then tried to delete the file in Windows Explorer, and it disappeared, but then reappeared in the UI again. Grrrrrr!

I also noticed that if I tried to change the properties of the file, it gave me a “There is no file with url” error, which pointed to some sort of corruption or orphaned file. I uploaded a new file over the top to resolve this error, but I still couldn’t delete the file.

Not a perfect solution, but the only way I could overcome the problem was to open the Master Page Gallery in Windows Explorer, create a new folder (I called it “Unused”), and move the master page into the folder. I could then upload the new master page and use it as normal. You will still probably want to perform the actions suggested in the Microsoft article referenced above to hide the faulty one, or it will appear in the Site Master Page Settings page in Site Settings, otherwise you will have two master pages to choose from – the replacement one recently uploaded and the old one preceded with the name of the folder you created to hide it.

4 comments: