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 207 posts 406 karma points
    6 days ago
    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 68 posts 379 karma points c-trib
    6 days ago
    Julien Kulker
    0

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

  • Huw Reddick 1031 posts 3490 karma points c-trib
    6 days ago
    Huw Reddick
    0

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

  • Chris Mahoney 207 posts 406 karma points
    6 days ago
    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