Copied to clipboard

Flag this post as spam?

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


  • Vyacheslav 13 posts 113 karma points
    Mar 22, 2021 @ 09:10
    Vyacheslav
    0

    How to get a property by key (GUID) from IUmbracoContextFactory

    Each item in a nested content contains Key property. Is it possible to find item of nested content by this key?
    Method GetById returns null.

    umbracoContext.UmbracoContext.Content.GetById(new Guid(key)); 
    
  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Mar 22, 2021 @ 14:44
    Huw Reddick
    0

    GetById should accept a guid, does key definitely have a value?

  • Mehmet Avcı 55 posts 240 karma points
    Mar 25, 2021 @ 11:28
    Mehmet Avcı
    100

    Hi,

    The method you are calling is used to fetch Content Nodes. However, you are trying to access a nested content, in another words, you access a property of a node.

    You first need to access the content then you can get the property you are looking for. Normally, property alias is used, if you cannot, you can manually search for it in the properties of the node.

    I hope this helps.

Please Sign in or register to post replies

Write your reply to:

Draft