1

I am trying to publish multimedia component in multiple structure groups using

engine.AddBinary(
    engine.LocalizeUri(component.Id), 
    engine.LocalizeUri(template.Id), 
    engine.LocalizeUri(sg),
    ms.ToArray(), 
    fileName
);

I have 2 multimedia components in one component. I want to publish those 2 multimedia components in different structure groups. 2 multimedia components has same image\css\pdf But its getting following error.

Phase:Deployment processing phase failed,Binary variant[Binary id=tcm:200-26587-16] variantId=tcm:200-26678-32 sg=tcm:200-17849-4 path="" is published into multiple structure groups(tcm:200-17890-4),which is not allowed,Binary variant[Binary id=tcm:200-26587-16] variantId=tcm:200-26678-32 sg=tcm:200-17849-4 path="" is published into multiple structure groups(tcm:200-17890-4), which is not allowed

Note:Multimedia components in my case include images, css, js, pdf etc

  • Welcome to Tridion Stackexchange, however, your question is not easily readable, not clear as well. I recommend you to change the format so that it becomes readable and provide clear description - What do you mean by publish multimedia component in multiple structure group? – Pankaj Gaur Jun 25 '14 at 10:05
2

It looks like you're trying to publish the same Multimedia Component (binary), tcm:200-26587, to two different Structure Groups. This is, as the error message clearly states, not allowed.

You can achieve this by creating multiple variants of the binary content.

Instead of using the Engine class's AddBinary() method, use an AddBinary() method of the RenderedItem class (available in your templating code via engine.PublishingContext.RenderedItem).

For example, using the AddBinary() method with the following signature...

public Binary AddBinary(
    Component multimediaComponent,
    StructureGroup location,
    string variantId
)

... and varying the variantId parameter, should allow you to publish the same multimedia component to two different Structure Groups.

If you don't need to modify the actual binary data in any way then you can just pass the exact same Multimedia Component twice with a different variantId parameter (perhaps the Structure Group ID?) each time. The variant data is published but is never stored in the Content Manager. This will work for any Multimedia Component; Tridion does not care whether your binary data is CSS, JPEG, PDF, MP4 etc. If you need to treat different binary data types in different ways then your code will need to inspect the filename/mime type/binary data and branch accordingly.

Be careful with this functionality... Consider if you really need to publish the same binary content to two different places and ensure that your variant IDs are unique to each use case or you may run into publishing issues when your deployer is asked to move referenced binaries around later on.

|improve this answer|||||
  • Thanks for the reply. If I would have to create 2 variants of the same binary, how should I proceed for the same? Do we have any API calls that creates/gets a variant for a binary component. In addition, the binary components in my case include images, css, js, pdf etc., If you could point me towards some examples, that would be of great help. – Rameshponna Jun 25 '14 at 12:48
  • @Rameshponna Added some information to my answer. If you need additional help I suggest you read some docs, try some code and see how it works. Googling for 'Tridion Variant' throws up yatb.mitza.net/2012/03/publishing-images-as-variants.html as the first result, which has a working example of creating and publishing a variant for an image – David Forster Jun 25 '14 at 13:06

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.