Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Laurent Lequenne 123 posts 248 karma points
    Sep 13, 2017 @ 08:50
    Laurent Lequenne
    0

    Versions and tracking of published versions

    Hi,

    I need to retrieve the published versions of a content, to sent it to some API. I'm using that piece of code below to retrieve my versions, but I don't find any flag that states if this version has ever been published.

    I need to track the previous published content name of a published item, as well I should be able to get an url of that version.

    Any idea on how to achieve ?

    ApplicationContext.Current.Services.ContentService.GetVersions(content.Id).ToList();
    
  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    Sep 13, 2017 @ 09:14
    Damiaan
    0

    The url is lost when a new version of the document is published.

    I am pretty sure that you'll need to subscribe to the ContentService.Published event. After a publish, just store the versionId, date, url along with other things you need in a new database table.

    Make is much easier to retrieve afterwards.

    Kind regards
    Damiaan

  • Laurent Lequenne 123 posts 248 karma points
    Sep 13, 2017 @ 09:55
    Laurent Lequenne
    0

    Yes, I do that operation on the published event as we need to be sure that the content is visible as it will be crawled by some search engine.

    Unfortunately we need also information on the previous state of the content, the umbracoRedirectUrl is not an option as we don't have the publish story either.

    So for now indeed either a table with all that information, either some preprocessing on the Publishing event (which could be some double expense on this action, as renaming url cause all descendants to be renamed as well) seems the only way.

Please Sign in or register to post replies

Write your reply to:

Draft