MCMS tip of the day – recovering deleted resources

Ever had the problem that you needed to do housekeeping on your MCMS database? Lots of space is often used by resources in resource galleries. So a good idea is to ensure that only used resource gallery items keep stored in the database. MCMS does not provide a public API to identify which resources are used in which posting. But here is a tool that can gathers this information:

http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=70b4c5bc-ac3f-4885-8af2-bf283edb9159

Using this tool will help to identify which resources are not currently used and which are still used.

But what if you already deleted a resource gallery item that was still used by a posting? You will experience ugly effects like broken images, unwanted authentication prompts and problems during save of the postings. The best would be to just undelete the accidently deleted resource gallery item – but such a function is not included in MCMS out of the box.

The good thing is: Microsoft now provides a solution for this. See here for more details:

http://blogs.technet.com/stefan_gossner/archive/2005/02/23/378718.aspx

8 Comments


  1. Hi Stefan,

    I use an XML placeholder to store our main content and have an html placeholder where I mirror the resources currently on the page(both local and gallery).

    I wanted to know if it would cause strange effects if I were to prevent the mirroring of the resource gallery items.  I mean when the MCMS background job runs.

    I ask because right now it seems that when a user is editing a page and tries to save it after having deleted a resource gallery item that is mirrored on our html placeholder, they are getting the normal "Save Placeholder Failed" error.  They only have access to the xml placeholder content so we end up having to go in manually and removing the bad html placeholder mirrored links to the deleted resource.

    Any thoughts?

    Reply

  2. Hi Brian,

    what do you mean by mirroring? You are not allowed to use references to local attachments or images on a different page.

    So this mirroring would have to be on the same posting.

    the behaviour you see is by design. Deleted resources are not really deleted but moved to the "Archive Folder" where only administrators have rights. That’s why you get the error when a non-Admin tries to save the item.

    You need to remove the references to deleted resource gallery items before saving – or better before deleting.

    Cheers,

    Stefan

    Reply

  3. Hi Stefan,

    When I say mirroring, I mean we have 2 placeholders on the same posting. One holds our custom xml that we use to render the content and the other is an html placeholder that holds links to our resources on the page.

    When the user adds a resource to the xml for the posting, we add an html link to the other placeholder so when the MCMS background process runs it can read the resources from the html placeholder as our xml placeholder does not contain normal links.  It contains custom nodes for our images and other resources.  I am told that the background process only knows how to read the links from the html placeholder.

    I am aware of the fact that the resources are still available to admins, but I wanted to know if I can remove that mirroring of resource gallery resources to our html placeholder without causing adverse background process effects that may delete the resources from the gallery causing broken links/images when we still link to it from our xml placeholder.  It appears we only mirror it for when the background process runs to prevent the resource from getting deleted, but it appears that maybe that job does not delete a resource gallery resource when it does not contain a link on any posting html placeholders.  Only when the user deletes it from the gallery.

    Thanks

    Reply

  4. Hi Brian,

    this will lead to inconsistancies!

    First of all: background processing will also look at XML placeholders. But only(!) if the link in the XML placeholder is within quotes.

    So this URL will not be found:

    <myLink>/NR/GUID/0/image.jpg</myLink>

    But these links will be found:

    <myLink>"/NR/GUID/0/image.jpg"</myLink>

    <myLink url="/NR/GUID/0/image.jpg" />

    You should avoid links to resource gallery items without quotes.

    Cheers,

    Stefan

    Reply

  5. Hi Stefan,

    When we create a new posting and click on save, we get a popup which asks us to enter name and display name of the posting.

    Is it possible to disable this?

    I have provided a textbox in the posting page property control whose value will be the name and display name of the posting.

    Regards,

    Ramana

    Reply

  6. The first link in this tip has been moved to the MSDN Code gallery, but I can’t find it.  Can you direct me?

    I’m having problems with resources deleted using Resource Manager on my authoring server not being deleted on my production server.

    Thanks, John

    Reply

Leave a Reply to Ramana Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.