Try our conversational search powered by Generative AI!

List asset folder content



For a certain page, say the start page, i have N number of asset folders (Folder1, Folder2, Folder3 etc). Stored in these are documents related to each folder.

I need to list the documents per folder. How do I get handles or such for each folder, and then read it's contents? I've been messing around with ContentAssetHelper and GetAssetFolder() (ie I googled it without finding any good examples) but with absolutely no luck at all.

Any help greatly appreciated.

Kind regards,


Apr 04, 2014 8:18

Hi, this code may be helpfull it lists all images for a page. It shold be fairly easy to list folders instead.


   public static IEnumerable<ImageFile> GetPageImages(PageData page)


            IEnumerable<ImageFile> images = null;


                if (page != null  && page.ContentAssetsID != Guid.Empty)


                    var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();

                    var contentAssetFolder = contentRepository.Get<ContentAssetFolder>(page.ContentAssetsID);

                    images = contentRepository.GetChildren<ImageFile>(contentAssetFolder.ContentLink);



            return images;


Apr 04, 2014 8:54

Thanks for your reply Daniel. Question: I'm trying to read the folders by replacing <ImageFile> (which I had working earlier) with <ContentAssetFolder> but that gives an empty result. It should, in my case, return a list or IEnumerable containing 4 folders.


IEnumerable<ContentAssetFolder> folders = repo.GetChildren<ContentAssetFolder>(contentAssetFolder.ContentLink);

Any ideas?



Edited, Apr 04, 2014 20:14

Instead of ContentAssetFolder, what is returned when you do IContent instead?

Apr 04, 2014 20:37

Try debugging with this IEnumerable<IContent> folders = repo.GetChildren<IContent>(contentAssetFolder.ContentLink);

Just to see if you have the folders in some "dynamic array structure way", then try to extract the folders and casting them if necessary.



Apr 07, 2014 9:04

Hello Joshua and Daniel,

enumerating IContent works perfect. The exact cast is <ContentFolder>.


Apr 07, 2014 12:00
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.