November Happy Hour will be moved to Thursday December 5th.

Best way of creating a document list

Vote:
 

I'm quite new to EPiServer so maybe there is a really easy solution to my problem, but I can't find any good information about this.

In a current project there is a demand that the editor should be able to add document lists on pages. These document lists should be able to list files and subfolders in the selected folder.

I was thinking that I could create a nested ul-list and expand/minimize the folders when the user clicks them.

My problem is how do I loop through content folders and their subfolders and create links to the files that are inside?

Can I use a ContentReference property to get a reference to the top-level folder and then loop through all the childnodes?

Should I create a custom object (like below) and render that in the Block View or is there a better way?

public class Folder {
    public string Name{get; set;}
    public IENumerable Files {get; set;}
    public IENumerable ChildFolders {get; set;}
}
#115408
Jan 14, 2015 15:36
Vote:
 

ContentRepository is able to work with Media folders as well. Just loop through child elements and build up your object graph out of what you have in media folders.

For me, view model seems to be more or less OK.

#115676
Jan 16, 2015 0:59
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.