BDelete – Delete a Tridion Blueprint item

February 15th, 2012 | Posted by Robert Curlette in Tridion | Tridion Custom Page

The Blueprinting feature of Tridion is really great and keeps all of our items ‘connected’ to the parent – and won’t let us delete an item if it has localized children. This is a problem when we want to clean up our system and remove old items – or if you’ve been using bCopy and accidentally copied an item you didn’t want to.   

BDelete is the inverse of BCopy – UnLocalizing all children and then after this deleting the parent.  This script does this for Components, Pages, Structure Groups, or Folders.

Scenarios – When you need to do pre-cleanup work

Delete Page:  Pages need to be unpublished first.  The tool does not unpublish pages.
Delete Component:  Components need to be removed from Pages, removed from Component Link fields in other Components, and unpublished.  The tool does not do this and it will fail.
Delete Folder:  Will work every time, no dependencies.
Delete Structure Group:  Will work every time, no dependencies.

Code

Code is on GitHub at https://github.com/rcurlette/TridionBDelete/blob/master/bDelete.asp

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

2 Responses

  • Alvin says:

    Wait, where’s the “B” from?

    Neat, just when I’m looking for TOM.NET examples I find your code. I wouldn’t have known to look for “MSXML 4.0” — subtle point that I’m sure you found from experience.

    Eventually, we’ll have to more over to Core Service for external API work (there’s a good explanation on why on SDL Live Content), but I’m seeing understanding Tridion in general helps with either. The constants (tcm ids), terminology, and concepts are all there.

    Cheers!
    did you catch a subtle plug for continuing with the PowerTools? 😉

  • robert curlette says:

    B is from Blueprint – these are Blueprint-aware utilities that function on a Blueprint parent and the action is applied to the parent and its’ Blueprint children. Currently in Tridion the only GUI action that is applied to both parent and children is publishing. Copying via the GUI only copies the item and ignores the children. Delete fails if it has localized children – even if you really want to delete the whole item, parent and children.

    Good point about using the Tridion 2011 Core Service for external API work. I have seen the strong hints that the TOM API is off limits to us except from the Event System and Template environments, and this is a change from pre-2011 where we would always reference the TOM API DLLs. The other change is that the Core Service is implemented using WCF 3.5 and expects us to create a Service Client within Visual Studio and then we use the generated client proxy to call the API. I have worked with it a bit and like it – although still find it not as fluent as the old-skool Tridion API. Maybe I am just holding onto the past a bit…

    PowerTools – YES! I am warming up with GUI Extensions at the moment and expect to move some of these VBScript tools to GUI Extensions / PowerTools in the near future.



Leave a Reply

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