Copied to clipboard

Flag this post as spam?

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


  • Jonathan Roberts 409 posts 1063 karma points
    Jun 16, 2016 @ 10:38
    Jonathan Roberts
    0

    How do I get the latest version of all pages that are unpublished

    How do I get the latest version of all pages that are unpublished? So basically I would like to create a report for users who have recently updated a page but is still under moderation and hasn't had the latest version published yet? Is this possible?

    Thanks Jon

  • Alex Skrypnyk 6182 posts 24283 karma points MVP 8x admin c-trib
    Jun 21, 2016 @ 15:26
    Alex Skrypnyk
    100

    Hi Jon,

    You can get all unpublished nodes with this code:

    var root = ApplicationContext.Services.ContentService.GetByLevel(1);
    
    var unpublishedNodes = new List<IContent>();
    
    foreach (var rootNode in root)
    {
        foreach (var unpublishedNode in rootNode.Descendants().Where(x => !x.Published))
        {
            unpublishedNodes.Add(unpublishedNode);
        }
    }
    

    After that you can get latest edited and other what you want.

    Cheers,

    Alex

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies