Copied to clipboard

Flag this post as spam?

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


  • Damon 217 posts 288 karma points
    Feb 11, 2016 @ 18:15
    Damon
    0

    How to check if a media item is a descendant of a particular node in the media section?

    Hi,

    you can easily check if a node is a descendant of another node, but how do you do this for media items? The same function does not seem to be available?

    Thanks a lot!

  • Daniel 60 posts 174 karma points
    Feb 11, 2016 @ 19:17
    Daniel
    0

    Could you show a snippet of code you're trying?

    This works for me:

    var testMediaId = 1207;
    var hasFolderAncestor = Umbraco.TypedMedia(testMediaId).AncestorsOrSelf("Folder").Any();
    
Please Sign in or register to post replies

Write your reply to:

Draft