Copied to clipboard

Flag this post as spam?

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


  • zs123 11 posts 102 karma points
    Jan 14, 2019 @ 15:12
    zs123
    0

    Get NestedContent Item by Guid id?

    Hello everyone. I have a problem getting items from NestedContent by their unique id. I know that they don't have integer id's but I was able to get Guid keys by using:

    public Guid Id => Content.GeKey();

    but...when i'm passing the key inside my controller to Umbraco.TypedContent(Id) it's returning null.

    Is this even possible? I need every item from nested content so that I can add it to my outlook calendar on click. enter image description here

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Jan 14, 2019 @ 15:17
    Hendy Racher
    101

    Hi zs123,

    The Examine Indexer/Searcher in the Look package supports the querying of NestedContent items by Guid - such you can return the IPublishedContent of a particular nested content item knowing only it's GUID.

    However if you know the hosting IPublishedContent item (and the nested content property alias), then you can iterate though all the nested content items looking for the one where the key matches.

    The Umbraco.TypedContent(key) will only return a content item with that key - unfortunately this excludes searching nested content items.

    HTH, Hendy

  • zs123 11 posts 102 karma points
    Jan 14, 2019 @ 15:23
    zs123
    0

    Thank for the clarification, Hendy.

  • zs123 11 posts 102 karma points
    Jan 15, 2019 @ 08:33
    zs123
    0

    However if you know the hosting IPublishedContent item (and the nested content property alias), then you can iterate though all the nested content items looking for the one where the key matches.

    Can you please give me some kind of example for this? I'm really struggling with it since yesterday...

Please Sign in or register to post replies

Write your reply to:

Draft