Andrew Connell [MVP MOSS]
1339 Posts |  39 Articles |  3304 Comments
.NET  |  MCMS  |  SharePoint  |  Office System
PDCBling
SharePoint Quick Links
Article Categories
Archives
Post Categories

View Andrew Connell's profile on LinkedIn

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?

Post Feedback

Title:
Name:
Email:
(email will not be displayed)
Url:
Comments: 
Please add 5 and 5 and type the answer here:    
All Comments Are Filtered & Moderated
Unfortunately comment spammers are just too effecient and are constantly dirtying up blogs with irrelivant 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 - 2008 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 4-day hands-on and 5-day online WCM classes for developers I offer through the Ted Pattison Group.

Get more information on the WCM courses!


Upcoming Classes
 Hands-on WCM:
 » Irvine, CA
   Aug 4-7, 2008
 » Atlanta, GA
   Sept 22-25, 2008
 Online WCM:
 » July 21-25, 2008

» Register today!

JAX Office Geeks
Jacksonville Office Geeks (JOG)
JOG is a special interest group in Jacksonville, FL dedicated to bringing the local SharePoint commnity together to share tips, tricks, ideas and best practices for developing solutions on the SharePoint platform.

Next meeting details...
When:
 » TBD
Topic:
 » TBD
Speaker:
 » TBD


» Subscribe to the JOG newsletter