Copied to clipboard

Flag this post as spam?

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

  • Fredrik Esseen 595 posts 831 karma points
    Feb 28, 2019 @ 13:52
    Fredrik Esseen

    Cant get media items

    Hi! Im testing Umbraco 8 and got stuck on getting files the way I'm used to.

    I just made a simple loop to iterate through all folders and files in the media section but no files where found, only the folder..? I did this in a Partial view.

    var DocRootFolder = Model.Parent.Value<Folder>("docFolder");
    <ul class="docs">
    @foreach(var folder in DocRootFolder.Children)
            @foreach(var doc in folder.Children)
                <a href="@doc.Url">

    I also tried to directly access an image just to see if I could get a hit but that gives me an error. var mediaItem = Umbraco.TypedMedia(1234);

    Are there any documentation ready for how to work with the media section?

  • Steve Morgan 1289 posts 4283 karma points c-trib
    Feb 28, 2019 @ 14:00
  • Fredrik Esseen 595 posts 831 karma points
    Feb 28, 2019 @ 14:06
    Fredrik Esseen

    Yes, that is nice but now working for me in Umbraco 8.

    "'UmbracoHelper' does not contain a definition for 'TypedMediaAtRoot' and no accessible extension method 'TypedMediaAtRoot' accepting a first argument of type 'UmbracoHelper' could be found (are you missing a using directive or an assembly reference?)"

  • louisjrdev 107 posts 343 karma points c-trib
    Feb 28, 2019 @ 14:39

    I believe the current equivalent would be:


    there is also


  • Fredrik Esseen 595 posts 831 karma points
    Mar 01, 2019 @ 11:37
    Fredrik Esseen

    Just realized when testing that there were no problem with my initial code..

    I deleted the pdf-files I uploaded and added them again and then they popped up! Strange!

    So forget all I wrote :)

Please Sign in or register to post replies

Write your reply to: