If you look at the CHM documentation for TOM.NET, you will see a plethora of AddBinary methods and their overloads. Why so many? I don't know, maybe for flexibility...
While some of them are clearly marked as 'internal', some are deprecated and the rest are just out there. So which ones to use? Well, the story is a bit longer here. Clearly, don't use those marked as 'internal'. However, the deprecated (or actually Obsolete) methods are the tricky ones. It seems they are only deprecated since Tridion 2011SP1, while in fact they are buggy. Different behaviors have been reported on them -- binaries becoming un-managed once published. This means, a Unpublish action would leave that binary behind on the Content Delivery side.
So which are the safe to use AddBinary methods?
While some of them are clearly marked as 'internal', some are deprecated and the rest are just out there. So which ones to use? Well, the story is a bit longer here. Clearly, don't use those marked as 'internal'. However, the deprecated (or actually Obsolete) methods are the tricky ones. It seems they are only deprecated since Tridion 2011SP1, while in fact they are buggy. Different behaviors have been reported on them -- binaries becoming un-managed once published. This means, a Unpublish action would leave that binary behind on the Content Delivery side.
So which are the safe to use AddBinary methods?
- In Tridion.ContentManager.Publishing.Rendering.RenderedItem:
- AddBinary(Component);
- AddBinary(Component, String);
- AddBinary(Component, StructureGroup);
- AddBinary(Component, StructureGroup, String);
- AddBinary(Stream, String, String, Component, String);
- AddBinary(Stream, String, StructureGroup, String, Component, String);
- In Tridion.ContentManager.Templating.Engine:
- AddBinary(TcmUri, TcmUri, TcmUri, Byte[], String);
Which AddBinary NOT to use:
- In Tridion.ContentManager.Publishing.Rendering.RenderedItem:
- AddBinary(Stream, String, String, String); - obsolete
- AddBinary(Stream, String, StructureGroup, String, String); - obsolete
- In Tridion.ContentManager.Templating.TemplatingRenderer:
- AddBinary(TcmUri, TcmUri, TcmUri, Byte[], String); - use Engine.AddBinary instead
Comments