Maybe I get you wrong, but @Model.StartPublish (or @Model.Changed) will give you the "last changed" date. No need to dive into versions.
However is you want to create a list of change dates you can use this code:
var cvr = ServiceLocator.Current.GetInstance<IContentVersionRepository>(); var publicationDates = cvr.List(currentPage.ContentLink, currentPage.Language.Name) .Where(s => s.Status == VersionStatus.PreviouslyPublished).Select(p => p.Saved);
I use this for finding out if the Changed date has been updated:
DataFactory.Instance.ListVersions(page.PageLink, page.LanguageBranch) .Where(version => version.Status == VersionStatus.PreviouslyPublished) .Any(version => version.Saved < Changed);
and then I print out the value of Changed if the code above returns true.
I am trying to get the Changed PageData property value from the first published version of a page to compare it with the latest published version.
The purpose of this is to write out "Last changed
" on an article.
How can I do it?
I have tried to use
but I can't get any PageData with it...