We have a requirement to fetch the last published date of a component. We are using ComponentPresentationFactory.FindAllComponentPresentations and passing in the TCM URI of the component.

In the xml returned by the above method, lastpublished date is coming as 0001-01-01T00:00:00 instead of the actual published date. Is there any work around available for this?

  • 1
    Is this for displaying a date in the final markup? I like the idea of automating the date, but also consider migrations, updates, and template changes (which all might include a republishing of the components). This isn't a problem if the business is okay with all of the dates being the same in these cases (confirm they'll never want to "backdate" something). I wrote a post on use cases for automating fields like this. Sep 24, 2013 at 21:05

1 Answer 1


This is indeed achievable. The following example should clear things up. You can use ComponentMetaFactory (passing in the publication ID), and then use it to retrieve the metadata for the component (passing in the Items ID). This can be used to gather all sorts of information about the components metadata such as creation dates, custom metadata, initial publication date, author, schema ID, title and more.

ComponentMetaFactory metaFactory = new ComponentMetaFactory(pubId);
ComponentMeta compMeta = metaFactory.getMeta(itemID);
Date lastPublished = compMeta.getLastPublicationDate();

Note that the item ID is not the TCM URI, it is the unique ID of the item (which is contained within the TCM URI). The format of TCM URIs is as follows: 'tcm:publicationID-itemID-itemType'. You can write a small snippet of code to strip it out, and pass it into the getMeta(..) method. Hopefully this helps.

  • Thanks a lot for quick response @josh-hebb. I want to know is there any work around available for OData implementation?
    – Hiren Kaku
    Sep 24, 2013 at 20:45
  • 4
    Yes indeed. Odata offers the same entities, such as CustomMeta, as the usual Broker API. Just do a /odata.svc?CustomMetas$filter=PublicationID eq "123" and take a look at the browser output. Sep 25, 2013 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.