Copied to clipboard

Flag this post as spam?

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

  • Remko 118 posts 283 karma points
    Mar 12, 2019 @ 15:39

    V8 - IContent get Children?

    With ContentService it was alway easy to get a node as IContent and get it's Children too. Children (or GetChildren()) is gone now. What's the best way to get all Children of a certain node when you have an IContent object?

  • Marc Goodson 2097 posts 13922 karma points MVP 8x c-trib
    Mar 12, 2019 @ 17:23
    Marc Goodson

    Hi Remko

    The ContentService has a few methods that can help you out

    There is a GetPagedChildren method that will return an IEnumerable of IContent items, based on the Id of a content item:

    var contentId = 1234;
    //is there children for this content id?
    bool hasChildren = _contentService.HasChildren(contentId);
    //get the first 100 children... and has an out variable giving you the total count
    long totalChildren;
    IEnumerable<IContent> children = _contentService.GetPagedChildren(contentId, 1, 100, out totalChildren);
    //there is also a seperate ChildCount method
    var childCount = _contentService.ChildCount(contentId)



  • Magnus Eriksson 122 posts 362 karma points
    May 15, 2019 @ 14:09
    Magnus Eriksson

    With dependency injection, you can look at Sebastiaans posts in this thread for examples on how to do this:

    Regards, Magnus

  • Alexander Gräf 25 posts 131 karma points
    Dec 10, 2020 @ 12:17
    Alexander Gräf

    Just a heads-up that the _contentService.GetPagedChildren pageIndex parameter starts at 0, so you'd technically be fetching the second page already.

  • Remko 118 posts 283 karma points
    Mar 13, 2019 @ 15:10

    Hi Marc,

    Thank you.

    I found the GetPagedChildren, but thought there should be any .Children() entension method.. But guess I will then have to use this one.

Please Sign in or register to post replies

Write your reply to: