Post transaction type mismatch information

Using Tridion 2009, SP1, therefore, the old COM + TOM API. I try to get information about PublishTransaction, but I get an error every time I call the PublishTransaction.Information property.

Here is my code:

try
{
    var pubTrans = (PublishTransaction)tdse.GetObject("tcm:0-166535-66560",
                                                      EnumOpenMode.OpenModeView);
    Console.WriteLine("transaction id=" + pubTrans.ID);
    Console.WriteLine("transaction itemtype=" + pubTrans.itemType.ToString());
    Console.WriteLine("transaction info=" + pubTrans.Information);
}
catch (Exception e)
{
    Console.WriteLine(e.Message, e.StackTrace);
}

Above, transaction id and item type print well. I have another code where the Delete method works fine, but at any time when I try to get information, it explodes.

Here is the error:

<tcm:Error xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ErrorCode="D"
           Category="18" Source="Kernel" Severity="1">
  <tcm:Line Cause="false" MessageID="16138">
    <![CDATA[Unable to get Information of Unknown (tcm:0-166535-66560).]]>
    <tcm:Token>RESID_4485</tcm:Token><tcm:Token>Information</tcm:Token>
    <tcm:Token>RESID_4663</tcm:Token><tcm:Token>tcm:0-166535-66560</tcm:Token>
  </tcm:Line>
  <tcm:Line ErrorCode="D" Cause="true"><![CDATA[Type mismatch]]></tcm:Line>
  <tcm:Details>
    <tcm:CallStack>
      <tcm:Location>PublishTransaction.Information</tcm:Location>
      <tcm:Location>PublishTransaction.Information</tcm:Location>
    </tcm:CallStack>
  </tcm:Details>
</tcm:Error>

I searched the SDL Tridion World forum and could not find the answer. I am missing a fix, should I contact Support, or is there another way to get transaction information?

+3
source share
3 answers

( ), "" XMLElement, , ? , , , ?

+3

, PublishTransaction. : -

PublishTransaction pubTrans = (PublishTransaction)tdse.GetObject(
                                                    "tcm:0-4294103-66560",
                                                    EnumOpenMode.OpenModeView, 
                                                    null, 
                                                    XMLReadFilter.XMLReadNull);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(pubTrans.GetXML(XMLReadFilter.XMLReadAll));
XmlNamespaceManager nameSpace = new XmlNamespaceManager(xmlDoc.NameTable);
nameSpace.AddNamespace("tcm", "http://www.tridion.com/ContentManager/5.0");
nameSpace.AddNamespace("xlink", "http://www.w3.org/1999/xlink");
Console.WriteLine("transaction id=" + pubTrans.ID); 
Console.WriteLine("transaction itemtype=" + pubTrans.itemType.ToString());
EnumPublishTransactionState transState = pubTrans.get_State();
if (transState == EnumPublishTransactionState.Failed)
  Console.WriteLine("transaction info=" + 
    xmlDoc.SelectSingleNode("/tcm:PublishTransaction/tcm:Data/tcm:Information",
    nameSpace).InnerText); 
+2

I do not have a working environment, so I am just looking at any existing code that I have. This is a snippet from the Event system that removes the Queue element only if you have administrator rights:

public void OnPublicationPublishPost(Publication publication, IXMLDOMDocument2 publishResult)
{
    TDSE tdse = Utilities.GetTDSEInstance();
    publishResult.setProperty("SelectionNamespaces", "xmlns:tcm=\"http://www.tridion.com/ContentManager/5.0\"");
    PublishTransaction publishTransaction = Utilities.GetTridionItem<PublishTransaction>(publishResult.selectSingleNode("/*/*").attributes[2].text, null) as PublishTransaction;
    User user = Utilities.GetTridionItem<User>(publishResult.selectSingleNode("/tcm:PublishResponse/tcm:PublisherRequest/tcm:User").attributes[0].text, null) as User;
    TDSPrivileges isAdmin = user.privileges;
    if (isAdmin != TDSPrivileges.TdsPrivilegeSystemAdministrator)
    {
        publishTransaction.Delete();
    }
}
0
source

All Articles