Andrew Connell [MVP MOSS]
1543 Posts |  42 Articles |  4748 Comments
.NET  |  MCMS  |  SharePoint  |  Office System
SharePoint Quick Links
Article Categories
Archives
Post Categories


Add to Technorati Favorites

Seems to be quite a common question popping up recently... people are trying to delete their master page or page layout (or some other file) from the Master Page Gallery but keep getting the following error:

ItemCannotBeDeleted

Even though you think you cleaned up all the places where a file is being used, I've yet to see a bug in MOSS that says a file is being used yet it really isn't. Chances are, you just missed one (or two). The easiest way to find where a file is being used is to go to the Site Content & Structure page via Site Actions ยป Manage Content and Structure. Then open up the Master Page Gallery. You'll notice a option in the toolbar: Show Related Resources. Select that item to create a split view. Now each item in the Master Page Gallery (shown in the top pane) has a radio button next to it. Selecting one will show you all the places that file is being used throughout the site collection.

Here's a screen shot of a particular page layout and where it is being used within my site collection:

ShowRelatedResources

[Update 8/8/2007] Katrien has a good post when this is actually an error, also referencing the MSFT KB 926812.

Technorati tags: , , ,
posted on Wednesday, July 04, 2007 1:21 PM

Feedback

# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 7/5/2007 9:24 AM Shane Perran
Gravatar Great Tip Andrew. It is indeed a very common question.

# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 7/5/2007 1:01 PM Kanwal
Gravatar Thanks for the tip Andrew. Its now part of the buzz, SharePoint Buzz

# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 7/11/2007 4:35 PM Cale Hoopes - Ascentium Corp.
Gravatar Ok, so I have a master page. It says it uses like 5 resources, then it says its Used By itself and its Uses itself. I didn't do anything special here... its just a master page. However, when trying to delete it, I still get the "referenced" error. Any ideas?

# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 7/20/2007 6:57 AM Sandy Donaldson
Gravatar Hi all, getting the same problem as Cale, master page is referencing itself.

Is there any way to unreference then delete it?

# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 7/20/2007 10:12 AM AC [MVP MOSS]
Gravatar Cale/Sandy - Not sure... never seen that before. Try removing the master via the object model?

# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 7/20/2007 11:50 AM Sandy Donaldson
Gravatar Can you direct me how?

# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 7/20/2007 2:14 PM AC [MVP MOSS]
Gravatar Sandy-
Please refer to the SDK... but simply getting a reference to the item in the list and calling SPListItem.Delete() should do the trick. No idea if this would work... just an idea I'd try.

# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 8/7/2007 1:33 PM Jeff Roberts
Gravatar Andrew-
Katrien has found more information on this 'bug' as well as a work-around. Check out her blog article at: http://www.katriendg.com/aboutdotnet/Default.aspx?m=1&y=2007


# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 8/7/2007 5:04 PM AC [MVP MOSS]
Gravatar Jeff-
Thanks for the pointer... I'll update the blog post to point to her post and the MSFT KB in her post.

# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 3/17/2008 9:58 AM Kunz
Gravatar Is there a way to call this "Show related Resources" query programmatically?
Because i want to generate something like a report of files that are (not) referenced. No i have to click and wait for the page to reload to see if the file is referenced.

# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 3/24/2008 9:53 PM AC [MVP MOSS]
Gravatar Kunz-
I'm not sure offhand how it works, but you can definately do it via the API. As a general rule, anything MSFT does via the browser UI and STSADM is available to us as those two interfaces were built on top of the public SharePoint API.

# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 3/27/2008 2:57 PM Aaron Scholl
Gravatar This is definitely a nice feature to have but what I really want it for is to find out what Reusable Content items are being used by what pages if I want to delete a reusable content item.

I tried to use this same feature when in that list under Manage Content and Structure but I never get any items even though I know I have pages that use the reusable content. Any ideas?

# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 8/28/2008 6:53 AM chrissey man
Gravatar thanx a lot man, saved my day

# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 3/16/2009 4:58 AM tower defense
Gravatar It says it uses like 5 resources, then it says its Used By itself and its Uses itself. I didn't do anything special here... its just a master page. However, when trying to delete it, I still get the "referenced" error.

# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 6/2/2009 7:02 AM Maz
Gravatar I too have a master page that references itself it seems.
Key question: WHY does this occur? Is it down to the known microsoft bug (http://support.microsoft.com/kb/926812/en-us) or is it down to me?

What I am doing.
I have a feature which places a custom master in a MOSS 2007 site. The FeatureReceiver eventhandler for the Activated event sets a top site collection and all sub webs within it to use the custom master page. The Deactivating eventhandler undoes this.

I am sure that both those work correctly.

The only thing I can think of is that in the custom.master mark up I have the following line

<%@ Master Inherits="CustomIntranetMasterPage.Master,CustomIntranetMasterPage, Version=1.0.0.0, Culture=neutral, PublicKeyToken=10e2ca727a54ef9d" language="C#"%>


Is that responsible for this self-referencing?
If not is this known bug solved in SP2 MOSS

Thanks.


# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 10/24/2009 5:44 PM games
Gravatar This is definitely a nice feature to have, thanks a lot.

# re: Finding all references where a master page, page layout, or other file is used in a MOSS 2007 Publishing (WCM) site 2/3/2010 2:56 AM seo services
Gravatar These are awesome ! thanks for sharing.

Post Feedback

Title:
Name:
Email:
(email will not be displayed)
Url:
Comments: 
Please add 8 and 8 and type the answer here:    
All Comments Are Filtered & Moderated
Unfortunately comment spammers are just too effecient and are constantly dirtying up blogs with irrelevant and unwanted comments trying to improve their standing on search engines. All comments on this blog are moderated. I do not censor comments, but I don't approve comments with vulger language or those soliciting products. Most of the time comments are approved within a few hours of being submitted with the only exception when I'm traveling.

Why are you asking for my email address?
The only reason I'm asking for your email address, which isn't required to submit a comment, is to provide a gravatar if you've created an account for yourself and associated your email address with a small image. If you have a gravatar created for the email address you submit, it will appear next to your comment. Otherwise nothing will appear.

What is a gravatar?
A gravatar is a "globally recognized avatar." You can get more information about gravatars, as well as create your own for free, at www.gravatar.com. You can also view my gravatar here.


Copyright © 2003 - 2010 Andrew Connell
Creative Commons License 
This work is licensed under a Creative Commons License
Site design by Heather Solomon.

 
 
MOSS WCM Training
Looking for MOSS 2007 WCM developer training? Look no further! I teach my 5-day hands-on and online WCM classes for developers I offer through my company: Critical Path Training.

Get more information on the WCM courses!