-1

I need to fetch those TCM IDs from publishing queue which has been unpublished successfully using Tridion Core Service.

5
  • Hi Sudip. It would be useful if you could tell us what investigation you've done so far and what problems you've encountered please. A simple Google search should give some ideas of where to start (using both C# and PowerShell): google.co.uk/… Nov 30, 2018 at 8:29
  • Hi @JonathanWilliams, I have used PublishTransactionState but that will give me only publishing success and failed result. I want those item which has been unpublished successfully
    – User 45
    Nov 30, 2018 at 9:22
  • Off the top of my head, the PublishTransactionData object should contain details about the Publish Instruction. Nov 30, 2018 at 9:32
  • I am getting published success and failed data through PublishTransactionData. I want to fetch the unpublished success and failed data.
    – User 45
    Nov 30, 2018 at 9:47
  • @SudipGhorai, please add the comment and any examples to your original question to help others find this question and all of its context. Dec 5, 2018 at 22:04

1 Answer 1

6

You will have to use PublishTransactionsFilterData filter to retrieve all publish transactions based on your criteria.

                PublishTransactionsFilterData ptfd = new PublishTransactionsFilterData()
            {
                PublicationTarget = new LinkToPublicationTargetData() { IdRef = "tcm:0-19-65537" },
                ForRepository = new LinkToRepositoryData() { IdRef = "tcm:0-127-1" },
                PublishTransactionState = PublishTransactionState.Success
            };
 IdentifiableObjectData[] transactions = CoreServiceConnector.Client.GetSystemWideList(ptfd);

However, this filter has no info on resolve purpose, so you will have to read each transaction, get its ResolveInstruction.Purpose and check if its ResolvePurpose.UnPublish:

 foreach (PublishTransactionData transaction in transactions)
            {
                PublishTransactionData transactionData = (PublishTransactionData)CoreServiceConnector.Client.Read(transaction.Id, new ReadOptions());

                if (transactionData.Instruction.ResolveInstruction.Purpose == ResolvePurpose.UnPublish)
                {
                   // do something
                }

            }

Just an update, you have to read every transaction again with client.read because ResolveInstruction is not available on GetSystemWideList() because of lazy load.

4
  • Note that the Publish Queue in CME also shows Publish or Unpublish, so that info is available in the list data. I don’t have a system at hand to check which property it is, but I expect a PublishTransactionData property to reflect Publish/Unpublish in the list data (no need for full loads). Nov 30, 2018 at 10:14
  • its shown as Action="1" for Unpublish, Action="0" for publish, or Action="2" for republish, and min value of integer for uknown by client if XML is retrieved instead of objects.
    – Marko Milic
    Nov 30, 2018 at 10:18
  • So yeah, LINQ can be used to filter based on XML property if GetSystemWideListXml() is used.
    – Marko Milic
    Nov 30, 2018 at 10:19
  • Thanks @MarkoMilic, the reference code and instruction is really very helpful. my issue has been resolved by following your resolution steps.
    – User 45
    Nov 30, 2018 at 12:10

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.