Copied to clipboard

Flag this post as spam?

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


  • Chris Mahoney 235 posts 447 karma points
    Jan 25, 2023 @ 00:56
    Chris Mahoney
    0

    Descendants is only giving children

    Hi all,

    I'm upgrading a site from Umbraco 8.18 to 10.4 and I've run into an unusual problem. I have a page (ID 1493) with a hierarchical tree of business applications. In Umbraco 8 I'm using the following code snippet to get all apps:

    var allApps = Umbraco.Content(1493).Descendants<App>();
    

    However, if I use the same code in Umbraco 10.4 it only gets the children, not all the descendants. In fact, I can change .Descendants to .Children and it returns exactly the same data.

    Maybe my brain's just fried at the moment, but what in the world am I doing wrong here? How do I get all the descendants, including subpages?

  • Julien Kulker 75 posts 427 karma points c-trib
    Jan 25, 2023 @ 07:22
    Julien Kulker
    0

    My opinion it should work can i see your umbraco content tree

  • Huw Reddick 1737 posts 6098 karma points MVP c-trib
    Jan 25, 2023 @ 09:12
    Huw Reddick
    0

    Yes, should definitely work, does for me, although I am not using the typed <T> method, just .Descendants()

  • Chris Mahoney 235 posts 447 karma points
    Jan 25, 2023 @ 19:12
    Chris Mahoney
    100

    Figured it out, after some sleep :)

    The missing descendants were all showing in the backoffice as "This document is published but is not in the cache". I just had to republish them and they all showed up.

    Sorry for the confusion and thanks for trying to help :)

Please Sign in or register to post replies

Write your reply to:

Draft