Copied to clipboard

Flag this post as spam?

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


  • Shuchita 44 posts 153 karma points
    Jan 15, 2024 @ 14:16
    Shuchita
    0

    After upgrading Umbraco from V7 to V11, I noticed Media Picker not working with IPublishedContent.

    After upgrading Umbraco from V7 to V11, MediaPicker is not working in umbraco template. e.g.

    var node = Umbraco.Content(36490);

    var val1 = node.Value("colouredIconImage"); 
    var val2 = node.Value<MediaWithCrops>("colouredIconImage"); 
    

    colouredIconImage is media picker property which is upgraded from v7 to v11 enter image description here

    val1 and val2 both are null. I have also tried with cache refresh from umbarco backoffice settings but it is always null.

    If I will create new media picker property then it will work fine with IPublishedContent.

    when I access it using ContentService then I am able to get value but it is not good approach and I want to access it using IPublishedContent.

    Please let me know, how I can get value from IPublishedContent?

    Thanks.

  • Danine Noble 82 posts 368 karma points
    Jan 16, 2024 @ 16:40
    Danine Noble
    0

    Hullo Shuchita ^^

    Are the media pickers that are not working the Legacy data type? Since v8 (I think?) there was a split of Legacy Media Picker & Media Picker 3.

    Legacy accessed media via IPublishedContent, but the new one uses MediaWithCrops which looks to be how you're trying to access it. If you're trying to use MediaWithCrops on a legacy media picker datatype that could be the issue.

  • Shuchita 44 posts 153 karma points
    Jan 19, 2024 @ 06:35
    Shuchita
    100

    Thanks Danine for the reply.

    I have fixed using this way

    node.Properties.FirstOrDefault(x=>x.Alias == "colouredIconImage").GetSourceValue.
    

    all other ways of IPublishedContent are not working.

Please Sign in or register to post replies

Write your reply to:

Draft