November Happy Hour will be moved to Thursday December 5th.

How to understand if page was republished?

Vote:
 

Hi!

Do you know any way to understand, if page was republished - i.e. published second, third etc time - in EPi 8?
We have StartPublish, Created, Saved and Changed properties. All seems useless for this task.
StartPublish and Created don't change with republish.
Saved changes each time, so that even for 1-st publish it differs from Created.
Changed equals to Saved, but will freeze after the first publish. Looks promising, but the problem is - we have nothing to compare it to. We can say - 'ok, if Changed != Saved, then page is republished'
But here goes 'Update modified date' checkbox on a Settings tab, that sets Changed to Saved.
So that editor marks page as modified and whoooa - we've lost the only way to understand if it's republished.

I wonder if I miss something obvious, because such a feature might be required quite often.

#122311
May 29, 2015 18:27
Vote:
 

To see if a content is republished you can use the versioning system.

The following code will give you a list of previously published versions for the current page:

var versionRepo = ServiceLocator.Current.GetInstance<IContentVersionRepository>();
var publishedVersions = versionRepo.List(currentPage.ContentLink, currentPage.Language.Name)
                                                .Where(s => s.Status == VersionStatus.PreviouslyPublished);

See also this this post: http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=121854

#122327
May 30, 2015 11:34
Vote:
 

Thank you, Mark. I've forgotten about version repository and was digging in a wrong direction (

#122357
Jun 01, 2015 9:43
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.