Create a list of Media Folder Paths

Topics: Customizing Orchard
Jan 7, 2015 at 6:16 PM
I need to create a list of the currently existing folders within the media library so a user can select a folder to be used with an image slider. The slider can then display a specified number of images grabbed randomly from the folder. Thank you.
Jan 8, 2015 at 10:11 AM
Did you look at the MediaLibrary module to see how it's done there?
Jan 8, 2015 at 3:25 PM
I did, and it looks like I could create my list using the IMediaLibraryService and "_mediaLibraryService.GetMediaFolders(null);" but I'm a little confused on how to access the content within a folder once I have the path.
Jan 20, 2015 at 3:35 PM
I am trying to take the list of media folders and display it as a razor selectlist but I get an error when trying to cast _mediaLibraryService.GetMediaFolders(null).ToList() to a list of SelectListItem. Is there another way of displaying my System.Collections.Generic.List<Orchard.MediaLibrary.Models.MediaFolder> as a SelectList in razor? Thank you.
Jan 20, 2015 at 4:07 PM
I figured out how to go from a generic list to a selectlistitem list. I was under the impression setting the parameter to null in .GetMediaFolders(param) would get all folders but it only returns the folders that are in the root directory and none of the folders within those folders. Is there a good way of getting any folders inside other folders or will I have to go through each and every folder looking for folders within? Thank you.