Decommission a Publication Target

Decommission a Publication TargetWith the release of SDL Tridion 2013 SP1, we get a lot of new functionality. One of the interesting features I found was the ability to decommission a Publication Target. This feature is added to the Core Service, and currently not directly available from the UI. Which sounded like a good exercise to make a UI extension, with which you can call this new method.

So the little screenshot I have here showing you a Decommission command in the Context Menu of a Publication target, is something you will only have available after you installed my UI extension. Please also note that this was written purely as an exercise and an example, of how to be able to call this new Core Service method directly from the UI. I would not recommend installing this UI extension in a production system, as it allows Administrators at the click of a button, to decommission a Publication Target (no questions asked and no warnings given), with the result that all items that were once Published to this Target no longer have any Publish status related to this Target anymore. It does NOT unpublish the Pages, it just removes their Publish Status.

If you have ever restored a database of one Tridion system onto another Tridion system, then surely you will know how valuable such a command will be. For those situations, you could use my extension (although it would probably be easier and safer to just write a small application which calls this Core Service method for you). But I would actually recommend to use this extension as a learning experience into the UI extension model and how Editors, Models and Services work together.

Now lets take a look under the hood of this extension, it is basically built up out of two parts; 1. an Editor extension, 2. a Model extension. The Model extension is needed to actually call the Core Service ICoreService2013.DecommissionPublicationTarget(publicationTargetId) method through the UI extension (the Editor). For this I borrowed some code from the SDL Tridion Powertools project, as they have a nice setup with a BaseService and ServiceResponce classes. In the Model I define and register my DecommissionService, which creates a Core Service client and calls the ICoreService2013.DecommissionPublicationTarget(publicationTargetId) method.

The Editor extension is needed to register a new Context Menu option on Publication Targets, this way there is no need to do anything with security, as the Publication targets are only available to SDL Tridion Administrators anyways. The Context Menu option only works on the first selected item (it would be possible to make it work on multiple selections, but then the outcome could potentially be even more disastrous) and simply calls the Execute method of the DecommissionService.

Most of the code is completely reusable, you could simply change the Core Service method called and have this extension perform another function. I released it as open source on the SDL Tridion World Google Code project, and not as build extension on SDL Tridion World, since this is not something you will want to use on a production environment. To install the extension, just checkout the source code from Google code and use the built in Visual Studio Publish option to deploy the Editor and Model to the correct location. For this you need to build it directly on your CMS server and make sure you set the correct paths in the publish profile and post build steps.

3 thoughts on “Decommission a Publication Target

  1. Note that we do provide a UI for decomissioning a Publication Target out-of-the-box: a PowerShell cmdlet called Clear-TcmPublicationTarget.
    (Part of Tridion.ContentManager.Automation.dll)

  2. Hi Bart

    Thanks for sharing this! I’ll play around with this extension.

    Rick, I just did an Import-Module Tridion.ContentManager.Automation in powershell. But I don’t see a “Clear-TcmPublicationTarget”?

  3. Pingback: Tricking Tridion Into Unpublishing Content From Dead Targets | SDL Tridion Developer

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>