Copied to clipboard

Flag this post as spam?

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


  • blackhawk 313 posts 1367 karma points
    Oct 06, 2017 @ 20:46
    blackhawk
    0

    Umbraco.TypedMedia returns blank results on my page

    Just to give a little background, I'm building a custom search results page with examine. It will be indexing both content and media. On my razor template, I'm investigating the use of Umbraco.TypedMedia to reference media properties.

    • How do we use TypedMedia to call system fields like parentID, updateDate and nodeTypeAlias

    Here is a little piece of my code on my search page...

     var media = Umbraco.TypedMedia(searchResult.Id);
    

    How can I move forward with it? because I attempted to do the following...

     update date: @media.GetPropertyValue("updateDate")
    

    ...but this result shows up blank on my page. (no errors). I tried to rebuild my index from Examine Management, but its still blank....

    Thanks for any suggestions

  • blackhawk 313 posts 1367 karma points
    Oct 06, 2017 @ 21:19
    blackhawk
    100

    I just discovered the answer to my own question. Umbrao.TypedMedia like a wrapper for IPublishedContent Property Access, but for media assets. So I can reference all the built-in properties available for it, in addition to my custom properties.

    <p>update date: @media.UpdateDate</p>
    <p>description: @media.GetPropertyValue("Docdescription")</p>
    

    I'm good.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies