-1

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

  • 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/… – Jonathan Williams Nov 30 '18 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 – Sudip Ghorai Nov 30 '18 at 9:22
  • Off the top of my head, the PublishTransactionData object should contain details about the Publish Instruction. – Jonathan Williams Nov 30 '18 at 9:32
  • I am getting published success and failed data through PublishTransactionData. I want to fetch the unpublished success and failed data. – Sudip Ghorai Nov 30 '18 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. – Alvin Reyes Dec 5 '18 at 22:04
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.

  • 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). – Rick Pannekoek Nov 30 '18 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 '18 at 10:18
  • So yeah, LINQ can be used to filter based on XML property if GetSystemWideListXml() is used. – Marko Milic Nov 30 '18 at 10:19
  • Thanks @MarkoMilic, the reference code and instruction is really very helpful. my issue has been resolved by following your resolution steps. – Sudip Ghorai Nov 30 '18 at 12:10

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.