6

We are upgrading to Web 8.5 from 2013 SP1 and noticed the TOM.NET API on the C# TBBs by default behave differently on Web 8.5 as opposed to 2013 SP1.

We have a C# TBB like this:

IdentifiableObject identifiableObject = engine.GetObject("tcm:x-x-x");
System.Xml.XmlElement xmlElement = identifiableObject.ToXml();

In 2013 SP1 the xmlElement for a Publication looks like this:

<tcm:Publication xmlns:tcm="http://www.tridion.com/ContentManager/5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" ID="tcm:0-12-1" IsEditable="false">
    <tcm:Info>
      <tcm:LocationInfo>
        <tcm:WebDAVURL>/webdav/040%20Web%20Site</tcm:WebDAVURL>
        <tcm:Path>\</tcm:Path>
      </tcm:LocationInfo>
      <tcm:VersionInfo>
        <tcm:CreationDate>2014-04-24T09:43:29</tcm:CreationDate>
        <tcm:RevisionDate>2018-09-10T14:09:26</tcm:RevisionDate>
        <tcm:Creator xlink:type="simple" xlink:title="DOMAIN\12345" xlink:href="tcm:0-59-65552" />
      </tcm:VersionInfo>
      <tcm:AllowedActions>
        <tcm:Actions Allow="9216" Deny="3689344" Managed="0" />
      </tcm:AllowedActions>
    ...
</tcm:Publication>

In Web 8.5, however, the LocationInfo and the VersionInfo nodes are missing.

<tcm:Publication xmlns:tcm="http://www.tridion.com/ContentManager/5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" ID="tcm:0-12-1" IsEditable="">
  <tcm:Info>
    <tcm:AllowedActions>
      <tcm:Actions Allow="25600" Deny="3672960" Managed="0" AllowedActions="tcm:Search,tcm:View,tcm:Delete" DeniedActions="tcm:Publish,tcm:UnPublish,tcm:Edit,tcm:RePublish,tcm:BlueprintManaged,tcm:PermissionManaged,tcm:WorkflowManaged" />
    </tcm:AllowedActions>
  </tcm:Info>
  <tcm:Data>
    <tcm:Title>040 Web Site</tcm:Title>
  </tcm:Data>
</tcm:Publication>

I presume the default behavior in Web 8.5 doesn't load all the info and I'd have to explicitly load them. My questions are:

1) How do I get the XML to return the LocationInfo and VersionInfo?

2) Why is the default behavior in Web 8.5 different from 2013 SP1?

  • 1
    I am unable to reproduce this issue on my Web 8.5 server. I have tested following code: IdentifiableObject identifiableObject = engine.GetObject("tcm:0-XXX-1"); System.Xml.XmlElement xmlElement = identifiableObject.ToXml(); log.Debug(xmlElement.OuterXml); on both Tridion 2013 SP1 HR1 and Web 8.5 and both results have LocationInfo and VersionInfo in xml. – Stefan Klasnic Sep 26 '18 at 7:23
  • 1
    I'm not sure, Maybe permission Web 8.5 different from 2013 SP1 accessing the core service – Velmurugan Sep 26 '18 at 7:37
  • @StefanKlasnic Sorry, my question wasn't clear. I'm passing a Publication object to an IdentifiableObject and the XML was for the Publication object. So I have something like this: Publication publication = GetPublication(); and this publication is passed to another function that takes in an IdentifiableObject - GetWebDavUrl(IdentifiableObject idObject) { XmlElment xmlElement = idObject.ToXml(); log.Debug(xmlElement.xmlElement)} } – Sabarish Senthilnathan Sep 26 '18 at 13:54
  • 1
    @SabarishSenthilnathan maybe publication is not fully loaded in GetPublication() method. You can try to reload it in GetWebDavUrl() method with Load(LoadFlags flags) or Reload() methods. Also if you want to get WebDavUrl of your publication there is no need for GetWebDavUrl() method. Publication has WebDavUrl property that you can use. – Stefan Klasnic Sep 26 '18 at 14:14
  • Thanks @StefanKlasnic! You are right, we could use the Publcation's WebDavUrl property. We were just curious as to why not all properties aren't loaded in Web 8.5 when in 2013 sp1 it is loaded. This is just one example. We have several instances where we parse an XML to get the required properties for a better performance and if not all properties are loaded we'd have to refactor the code in several places. – Sabarish Senthilnathan Sep 26 '18 at 14:27
5

Apparently when you pass a Publication object to a function that takes in an IdentifiableObject GetXXX(IdentifiableObject identifiableObject), the identifiableObject's XML will have less information to reduce the load in Web 8.5 and I had to explicitly load the state of the object using load flags as this would impact the result of the ToXml() method. So before getting the XML, I had to do:

identifiableObject.Load(LoadFlags.Expanded);

This wasn't necessary for 2013 SP1.

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.