1

I have a list of component tcm ids, and a list of target tcm ids but I don't know which component will publish with which target. How can I calculate the mapping?

This is my code to check which Component I have to publish in which target

public static void PublishComponents(SessionAwareCoreServiceClient client,string[] listofComponentsTCM)
{
    List<KeyValuePair<string, string>> listodtargets = getAlltargetTCM(client);
    try
    {
        string[] Components = new string[] { "tcm:71-16393" };
        var targets = new string[] { "tcm:0-1023-65537" };
        PublishInstructionData instruction = GetPublishInstructionData(arguments);
        client.Publish(Components, instruction, targets, arguments.Priority, null);
        var data = client.GetListPublishInfo("tcm:71-16393");
    }
    catch (Exception ex)
    {
        throw ex;
    }
    finally
    {

    }
}

I am using SDL Tridion 2013 with CM DLL

2
  • 1
    This isn't enough information. Can you please share code of how you got these lists? Are you sing Tom.Net and which version of Tridion? Jun 3, 2015 at 19:18
  • Please read up on the help section on how you can edit your question and format it (tridion.stackexchange.com/editing-help). Don't use the answers or comments for adding additional information to your question. Also try formulating your question from a strangers persp[ective, we don't know what you did or where you are exactly stuck with unless you tell us everything. Don't worry about supplying too much information, or asking beginners questions, that is what we are here for, and we will gladly help you, as long as we know what to help you with exactly. Jun 5, 2015 at 8:24

1 Answer 1

7

Pseudocode:

For each component  
  From the component determine the publication  
  For each publication target  
    From the publication target determine the publication bindings  
    If publication in publication bindings component can be published to this target (if not the component cannot be published to this target)  
  Next  
Next

You can get the component's publication via the ContextRepository attribute. The publication targets publication bindings are accessed via the Publications attribute.

Your Answer

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

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