Copied to clipboard

Flag this post as spam?

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


  • Andrew 25 posts 148 karma points
    May 13, 2021 @ 12:55
    Andrew
    0

    Unable to get Media ID

    Hi guys,

    When I'm trying to get back a media item to object that is returned is of type: 'Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedMediaCache+DictionaryPublishedContent'

    I've tried to find some information around this but don't seem to be having much luck. Can anyone share some information about why this type is returned and how it can be managed?

    Thanks,

    Andy

  • Brendan Rice 538 posts 1102 karma points
    May 13, 2021 @ 13:19
    Brendan Rice
    0

    Can you show your code please?

  • Andrew 25 posts 148 karma points
    May 14, 2021 @ 08:06
    Andrew
    0

    Hi Brendan,

    There's not much to show tbh, I've got a media picker with the alias 'bannerImage' and then using:

    @Umbraco.Field("bannerImage") returns Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedMediaCache+DictionaryPublishedContent

    @Model.Content.GetProperty("bannerImage") returns Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedProperty

    @Model.Content.GetPropertyValue("bannerImage") returns Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedMediaCache+DictionaryPublishedContent

    No matter what I try its returning these types rather than IPublishedContent, I've tried casting it also but that hasn't helped.

    Thanks,

Please Sign in or register to post replies

Write your reply to:

Draft