Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am using media service to try and get all media items and folders, This is proving extremely difficult.
Has anyone ever done this on umbraco v7. There seems to be countless posts on this with no replyies so is this a taboo or something??
Thanks
Nav
Hi Naveed,
What the problem do you have?
Cheers
Hi Alex,
I am using media service to try and get all media items and folders.
I want to get all items from within the folders too.
This is what I have so far..
var allItems = Services.MediaService.GetRootMedia(); foreach (var item in allItems) { if (allItems.) { } }
I currently get all items under media and folders.
What I am now trying to do is get into the folders and get the items within there too
You need something like :
var allItems = ApplicationContext.Services.MediaService.GetRootMedia(); foreach (var item in allItems) { foreach (var descendant in item.Descendants()) { } }
I have tried that but get an error that Umbraco.Core.Models.Imedia does not contain definition for Descendants :-(
var allItems = ApplicationContext.Services.MediaService.GetRootMedia(); foreach (var item in allItems) { foreach (var descendant in item.Descendants()) { <text>@descendant.Name</text> } }
Worked for me, what version of Umbraco are you using?
Cheers, Alex
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Media Service
I am using media service to try and get all media items and folders, This is proving extremely difficult.
Has anyone ever done this on umbraco v7. There seems to be countless posts on this with no replyies so is this a taboo or something??
Thanks
Nav
Hi Naveed,
What the problem do you have?
Cheers
Hi Alex,
I am using media service to try and get all media items and folders.
I want to get all items from within the folders too.
This is what I have so far..
I currently get all items under media and folders.
What I am now trying to do is get into the folders and get the items within there too
Thanks
Nav
You need something like :
Hi Alex,
I have tried that but get an error that Umbraco.Core.Models.Imedia does not contain definition for Descendants :-(
Nav
Worked for me, what version of Umbraco are you using?
Cheers, Alex
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.