We are currently working with 2013 SP1 version and got a requirement to publish binaries without any TCM URI getting appended to it. I am aware of duplicate binary issue which is fine with the customer rather than TCM URI getting appended.

I have tried using AddBinary() in c# template passing the the binary filename to it. Publishing seems to be working fine but un-publishing doesn't seem to work as I could see the image still in place even after un-publishing the Component it is linked to or the multimedia Component as well. Am I missing the basic understanding?

Is this approach correct? If yes, do let me know what scenarios we need to take care and how when we are just using the filename as we are manipulating the default process.


As I am "implicitly" publishing multimedia as Frank van Puffelen explains this isn't really publishing in the strict sense in the Binary Event Tracker post. When such a binary is no longer referenced in Content Delivery, it is removed. But in my case it isn't. Does that mean am I missing any configuration on deployer end?

1 Answer 1


When wanting to publish a binary with a different name (allowing you to not have the TCM URI appended), you have to make sure you are using the right AddBinary() method.

There are two obsolete AddBinary() methods:

  1. RenderedItem.AddBinary(Stream, String, StructureGroup, String, String)
  2. RenderedItem.AddBinary(Stream, String, String, String)

All other overrides of AddBinary either take a Component as (one of) their input parameter(s), an Item from the Package, or a TCM URI, which will ensure the binary you are publishing is published as a variant, and thus will be treated as a managed binary. Only managed binaries are removed when the Page which is using them is unpublished (and there are no further references to those binaries).

So in short, there is nothing wrong with your configuration on the Deployer side, nor can you change anything there that would modify the bahaviour of managed and unmanaged binaries, it all comes down to what you are using in your Template code.

  • Thanks Bart for pointing it out. Below is the snippet I am using and I am passing structure group as null as I want it to be deployed to the path mentioned in publication properties. Am I using the wrong method? multimediaURL = Engine.PublishingContext.RenderedItem.AddBinary(ms, filename, string.Empty, null, component.BinaryContent.MultimediaType.MimeType).Url;
    – Guest19876
    Nov 9, 2016 at 10:36
  • Yes that is one of the obsolete methods I mentioned, so don't use that one. You should use either Engine.AddBinary(TcmUri, TcmUri, TcmUri, Byte[], String) or RenderedItem.AddBinary(Stream, String, String, Component, String) Nov 9, 2016 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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