tridiontridion-2011

How can I get the date/time at which the item was last published in Tridion


How can I get the date/time at which the item was last published.

I tried to create object for PublishInfoData inorder to use PublishedAt.

  PublishInfoData pobj = csClient.Read(pageTCMID, readoptions) as PublishInfoData;

But this gives error like cannot convert IdentifiableObjectData to PublishInfoData.

Please suggest.


Solution

  • This will give you all publish info:

    csClient.GetListPublishInfo(pageTCMID);
    

    And then you have to select the latest:

    var publishInfo = csClient.GetListPublishInfo(pageTCMID);
    var lastPublishedAt = publishInfo.OrderByDescending(pi => pi.PublishedAt).First().PublishedAt;