9

The 2013 SP1 Publishing Queue shows some great information for failures, including at which stage the publish failed and, for render failures, what the error was.

I have been looking through the documentation and the object model, and I haven't found how to obtain the same information.

There are other answers that use the event system to record this information, but I'm looking to get it in the same way that the Publishing Queue does.

How can I get the failure details -- state and render error -- from the core service?

17

Via core service you can retrieve PublishTransactionData object, which contains all info about transaction itself:

PublishTransactionData transaction = (PublishTransactionData)Client.Read(transactionID, new ReadOptions());
PublishTransactionState transactionState = transaction.State;
DateTime transactionStateChange = transaction.StateChangeDateTime;
string transactionError = transaction.Information;

Also, you can check PublishTransactionData class in Core Service API for additional properties: enter image description here

  • What I was missing was that a) that the list contains a subset of information, and that I needed to retrieve the full failure message separately; and b) to look in the information field. I had already realized the list vs. full message issue. Thanks for directing me to the information field. – Paul Russell May 7 '17 at 15:31
6

To mimic the filtering capabilities of the Publishing queue, take a look at the PublishTransactionsFilterData and its properties. Use the filter paired with GetSystemWideList or GetSystemWideListXml and you can obtain an array of PublishTransactionData or their Ids.

If you have a publish transaction id, you can read it by using the Read method and the resulting object (once cast into PublishTransactionData) will have the properties you need.

Specifically:

  • HasRenderFailures - "True if at least one of the ProcessedItems in this instance has render failures; otherwise, false."
  • Information - "Information about the reason of a failed publish transaction."
  • State- "The state of this instance."

Sample code:

XElement transactionsXElement = client.GetSystemWideListXml(new PublishTransactionsFilterData());
string[] transactionIds = transactionsXElement.Elements()
    .Select(singlePublishTrancaction => singlePublishTrancaction.Attribute("ID").Value).ToArray();
PublishTransactionData publishTransaction = (PublishTransactionData)client.Read(transactionIds[0], null)

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.