9

We have a custom deployer which stores DCPs in a third party data store. In order to un-publish those DCPs I need to send the deployer a custom value and key.

By default, an unpublish transaction package contains a transaction.xml and an instructions.xml. Is there any way to either add to these, or add additional xml files to the package?

1 Answer 1

13

The problem here is that it is an unpublish operation and no templates are executed and we cannot use the AddInstructions method available in the RenderedItem class.

As an alternative there is a non documented extension point called a TransportHandler, you need to implement the ITransportHandler interface that is located in a GAC assmebly Tridion.ContentManager.Publishing.Transporting.dll.

This interface gives you access to the TransportPackage and you can manipulate it when an item is certainly unpublished.

Here a code sample.

public class CustomTransportHandler : ITransportPackageHandler {
    private XmlDocument _instructionsDocument;

    public CustomTransportHandler(TransportPackage package) {
        _instructionsDocument = package.InstructionsDocument;
    }

    public void HandleItemForPublishing(object item, XmlElement parentElement) {
        throw new NotImplementedException();
    }

    public XmlElement HandleRenderedItemForPublishing(RenderedItem renderedItem, XmlElement parentElement) {
        throw new NotImplementedException();
    }

    public void HandleResolvedItemForUnPublishing(ResolvedItem resolvedItem) {
        XmlElement customElement = _instructionsDocument.CreateElement("CustomElement");
        customElement.InnerText = "CustomValue";
    }
}

You can configure it in the Tridion.ContentManager.config file.

<transporting rootStorageFolder="c:\Temp">
    <mappings>

    </mappings>
</transporting>

I hope this helps.

2
  • 1
    great answer and thanks for sharing. What's the impact on Supportability by using this extension, i.e. can a service pack or version.next make use of it incompatible? Commented Aug 21, 2013 at 16:42
  • 4
    Since it is a not documented feature, R&D can change it, it is a cool and advanced extension point, but can be changed in future releases.
    – Eric Huiza
    Commented Aug 21, 2013 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.