Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

File list for editorials


I am rather new at episerver started now on the 7.5!

I want editors to easy choose files from a mapp and make link of them

In ver 6 there looks like there is something called dynamic content and file list!

See it in this video

Thats the easy solution I want! Is that solution avaible in  7.5?

I cannot find it!

// Markus

Jan 27, 2015 12:01

You can make a block for that and insert it in the text editor (XhtmlString property).

Just one property needed on the block type:

public class FileListBlock : BlockData
    public virtual ContentReference FolderPath { get; set; }

Then you can use IContentRepository to get the children (files):

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

IEnumerable<MediaData> files = contentRepo.GetChildren<MediaData>(myBlockContent.FolderPath);

In your block view you just render <ul> with links to the files:

    @foreach (var file in files)
        <li><a href="@Url.ContentUrl(file.ContentLink)">@file.Name</a>
Edited, Jan 29, 2015 11:04
* 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.