Copied to clipboard

Flag this post as spam?

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


  • Tom 713 posts 954 karma points
    Jun 25, 2013 @ 03:13
    Tom
    0

    Umbraco v6 Media?

    Hi we've moved from 4 to 6 and looking at the documentation for 6 it's not that clear what the best way of simply retrieving some media via the api in your codebehind??

    I found one reference in a blog post but it's not in the documentation and i don't know if it's right:

    ApplicationContext.Current.Services.MediaService

     

    this article doesn't mention it anywhere:

    http://our.umbraco.org/documentation/Reference/Management-v6/Services/MediaService

     

    is there a good getting started with ApplicationContext etc.. the documentation doesn't provide any real examples..

     


  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 25, 2013 @ 03:31
    Tom Fulton
    100

    Hi Tom,

    You're right that you want to use MediaService.  How you access it might depend on where you're writing the code - is it for a usercontrol?  If so you should adjust your usercontrol to inherit from UmbracoUserControl - then you'll automatically have access to MediaService by just:  Services.MediaService

    In other areas you should be able to use the ApplicationContext - what troubles are you having with that?

    Hope this helps,
    Tom 

  • Tom 713 posts 954 karma points
    Jun 25, 2013 @ 03:34
    Tom
    0

    Hi Tom,

    Cheers! just wanted clarification.. because it wasn't documented anywhere other than that blog post..

Please Sign in or register to post replies

Write your reply to:

Draft