Copied to clipboard

Flag this post as spam?

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


  • Keith Jackson 183 posts 552 karma points
    Mar 26, 2014 @ 18:28
    Keith Jackson
    0

    How to load Umbraco.Core.Models.Media by ID

    I'm trying to remove some of my obsolete old code in a U6 solution I'm upgrading to U7.

    I've got various references using the old Media object, created by passing in the ID. How do I do a similar thing in U7 with the new Media object? 

    I'm looking for something like MediaProvider.LoadMedia(int id) or similar.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Mar 26, 2014 @ 18:30
    Jeroen Breuer
    100

    Hello,

    You can use Umbraco.TypedMedia(id). More info here: http://our.umbraco.org/documentation/Reference/Mvc/querying

    Jeroen

  • Keith Jackson 183 posts 552 karma points
    Mar 26, 2014 @ 19:16
    Keith Jackson
    0

    Thanks Jeroen!

Please Sign in or register to post replies

Write your reply to:

Draft