Copied to clipboard

Flag this post as spam?

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

  • Nadine Fisch 78 posts 241 karma points
    Sep 14, 2017 @ 08:08
    Nadine Fisch


    I'm really, really new to Umbraco and razor, but I have to implement new features in Umbraco project.

    So I need some advices, because I'm not fully familiar with the syntax and the possibilites. And I do not exactly know how to use the dynamicObjects-Syntax, and I don't even know the correct term for this :)

    I want to select all children from all nodes from a certain hierarchy level.

    I think about a structure like this:

    var list = new List<dynamic>( node1.children.And.node2.children.where());

    Does anyone understand my problem and know how I can achieve this? Or do you have some enlightening tutorials about using dynamicObjects

    Thank you

  • Alex Skrypnyk 4507 posts 16111 karma points MVP admin
    Sep 14, 2017 @ 10:22
    Alex Skrypnyk

    Hi Nadine

    Welcome to our forum!!!

    First of all, do not use dynamics with Umbraco, use strongly typed objects if it's possible :)

    Read this "Common Pitfalls Tutorial" -



  • Nadine Fisch 78 posts 241 karma points
    Sep 14, 2017 @ 10:40
    Nadine Fisch

    Thank you :-)

    yeah the current project here is full of dynamics. So, I tried to do this in the same way, but thank you for your link and your feedback.

    Can you say what happens in Umbraco 8, if IPublishedContent will be removed? I saw this hint in your document. Will I have to rewrite all the code with the current "dynamicObject" - solution ?

  • Dan Diplo 1267 posts 4650 karma points MVP c-trib
    Sep 14, 2017 @ 11:16
    Dan Diplo

    I believe Umbraco 8 will remove all dynamic, so it may well require rewriting all these (or, at very least, suffering warnings they are deprecated).

    You can find more general docs on strongly-typed querying here:

    I may be misunderstanding, but if you want to select all nodes from a common ancestor then you can use the Descendants. So you could do:

    var list = ancestor.Descendants();

    You can just get descendants of a particular document type alias by adding the alias as a parameter:

    var list = ancestor.Descendants("newsItem");
  • Nadine Fisch 78 posts 241 karma points
    Sep 14, 2017 @ 12:08
    Nadine Fisch

    Thank you this solution works for me :)

Please Sign in or register to post replies

Write your reply to: