Get the date / time published by Sitecore

A simple question, I think: is there any value, whether in the API or the web database, that will tell me that the last time the content was published using sitecore? It looks like there is an “Updated” column in the “Items” table that can do this, but I would like to be sure. I do not need to know the individual elements, only the last time that any content has been published.

+4
source share
2 answers

If (if and only if) a publication is a full site publication or step-by-step publication, Sitecore writes this date to the database and can be retrieved from the main database using

Database.Properties.GetLastPublishDate(Database target, Language language) 

Otherwise, if you want to publish the date of any , you probably need to create a handler for the publication pipeline to write this date somewhere.

+8
source

I stumbled upon this, looking for something like that. Something like this worked for me:

 public String PostDate() { DateTime postDate = Context.Item.Statistics.Updated; return postDate != null ? postDate.ToString("MMMM dd yyyy H:mm:ss tt") : String.Empty; } 
+3
source

Source: https://habr.com/ru/post/1434090/


All Articles