Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Best way to create property to pick folder


1. Is there a property to use when I want to pick a folder in admin?

If not

2. Has anyone tried this folder browsing property with EPiServer 7?
3. If I need to create one myself, how do I do? I have done a dropdown myself but that's it, don't see how to create a whole document picker property.


Nov 21, 2013 18:15

Regarding nr 2, yes I have used it with EPiServer 7 (though the UI seriously needs an upgrade).


Nov 21, 2013 18:29

The out-of-the-box functionality is to have a string property, and then let the editor drag-n-drop folders into that property.

Nov 25, 2013 20:32

HaBu, that works for block folders. Not file folders. It will probably work in 7.5 as well with the new filemanagement.

Nov 26, 2013 6:01

No, that won't work either. File folders are not IContent. In EPiServer 7.1.2 and below, they are UnifiedDirectory.

But with some minor modifications to your code, and with a custom ISelectionFactory, it should work. This is untested code though:


        TargetType = typeof(string),
        UIHint = UIHint)]
    public class FolderEditorDescriptor : EditorDescriptor
        public const string UIHint = "FolderPicker";

        public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
            this.SelectionFactoryType = typeof(FolderSelectionFactory);

            this.ClientEditingClass = "epi-cms/contentediting/editors/SelectionEditor";

            base.ModifyMetadata(metadata, attributes);

    public class FolderSelectionFactory : ISelectionFactory
        public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
            var root = HostingEnvironment.VirtualPathProvider.GetDirectory("GlobalFiles") as UnifiedDirectory;

            return this.GetSelections(root, 0);

        private IEnumerable<ISelectItem> GetSelections(UnifiedDirectory root, int level)
            var folders = new List<ISelectItem>();

            foreach (var folder in root.GetDirectories())
                var text = new StringBuilder()
                    .Append((char)160, level)
                    .Append(" - ")

                folders.Add(new SelectItem()
                    Text = text,
                    Value = folder.VirtualPath

                level = level + 2;

                folders.AddRange(this.GetSelections(folder, level));

                level = level - 2;

            return folders;

And in your content type:

    Name = "Folder",
    GroupName = SystemTabNames.Content,
    Order = 1)]
public virtual string Folder { get; set; }


Edited, Nov 26, 2013 6:29

Hi Johan,

I'm totally wrong!

But I think in this case we can use Url property instead of string and SelectionEditor!


Our editor can be UrlSelector (with custom selection mode param "browserselectionmode" is FileManagerSelectionMode.Folder).



Hope that help!


Nov 26, 2013 7:36

Thanks for your answers! Will definitely try them out. How can you have so much inside knowledge of code specific 7.5? Has it been released yet? (I know everyyhing will get content but this is a bit more :P )

Another question as well, where do you find all of theese properties? Have been searching a lot.


this.ClientEditingClass = "epi-cms/contentediting/editors/SelectionEditor";


Edited, Nov 26, 2013 8:29

Hi Andreas,


I've some answers for your questions:

(1) Has it been released yet? No, not yet

(2) where do you find all of theese properties? You can use :

+ Document for EPiServer CMS 7:

+ Class-library


or post any question here ;)

(3) (not important question) How can you have so much inside knowledge of code specific 7.5?

I think these aren't "so much" (just for me - although I'm a developer (facepalm)).

About Johan I think "ECD" in his picture profile said all ;)




Nov 26, 2013 8:43

Hey all, there is a solution to have a Url to Folder property in this thread:

It is similiar to what Ha Bui suggested with setting the browserselectionmode parameter of the file selector.

Edited, Nov 27, 2013 9:43

Thanks, will try it out!

Nov 27, 2013 10:51


Just want addition a bit from Ben's posting:

"If you add a reference to "EPiServer.Cms.Shell.UI" dll and make "FolderUrlEditorDescriptor" inherited from "EPiServer.Cms.Shell.UI.ObjectEditing.EditorDescriptors.UrlEditorDescriptor" then everything done!"

[EditorDescriptorRegistration(TargetType = typeof(Url), UIHint = "FolderPicker")]
    public class FolderUrlEditorDescriptor : UrlEditorDescriptor
        public FolderUrlEditorDescriptor()
            ClientEditingClass = "epi-cms.widget.FileSelector";
            EditorConfiguration["fileBrowserMode"] = "folder";


Hope that help!


Nov 28, 2013 10:43

Please do not reference the EPiServer.Cms.Shell.UI.dll from your project. This assembly is located in the UI module (not the bin folder) and will cause you deployment and upgrade headaches if you reference it.

Nov 28, 2013 11:12

Many thanks to Ben for that information and sorry Andreas!

Keep silent is best for me in this case! :D

So sorry again!


Nov 28, 2013 11:23


I should keep slient but I can not :)

Hey Andreas, please try this:

[ContentType(DisplayName = "FolderPickerBlock", GUID = "47f4bd03-03d2-44be-9316-0985067469b6", Description = "")]
    public class FolderPickerBlock : BlockData
        [Display(Name = "Folder link")]
            ClientEditingClass = "epi-cms.widget.FileSelector",
            EditorConfiguration = "{ \"fileBrowserMode\": \"folder\" }"
        public virtual Url FolderUrl { get; set; }



Ha Bui

Nov 29, 2013 4:08
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.