Login

Accessing file properties in UnifiedFileTree

Versions: 4.40, FAQ number: 170, Old FAQ number: 9706

Why can´t I access some of the UnifiedFileTrees properties from my aspx script?

In the web.config file for your site, there is a section named “UnifiedFileSystem”. In this section you can decide if you want EpiServer to handle files in a certain directory for you or if you want to use the existing directory structure under your site. By setting “virtualShare” to “true” you are telling EpiServer to create a virtual directory. When setting this option, you also need to define the actual path to store files that are saved into this directory. These files will then be handled by EPiServer and may, for example, benefit from EpiServers version handling since you may have different versions for files in virtual directories.

The metadata for a file stored in a virtual directory is defined in an external .config. In this file you may add the different properties you wish the editors to have access to and what types those properties should be. This is done with xforms. To access these you need to use the Dictionary collection member of “Summary”.
For files not handled in a virtual directory you use the properties belonging to the UnifiedFile.Summary object directly.

For a file not residing in a virtual directory, the basic properties are:

Author
Category
Comments
Keywords
Subject
Title

How do I create a virtual directory?

- Open the web.config file located in the base folder of your site. 
- Look for the UnifiedFileSystem section.
- Add a new handler for your directory, in this example we will create a directory called “Application forms”.
- Set “virtualShare” to “true”.
- Add a customsetting that defines the physical path to your directory.
- Create a summary.config that defines the editable properties for files in your virtual directory.
- Add a tag that points to this new file in your web.config.

When finished, your new entry in web.config should look something like this (in this example we tell EpiServer to save the records of max 7 versions of a file):

<UnifiedFileSystem>
    <mappings>
    </mappings>
    <handler
        virtualName=”Application forms”
        customFileSummary=”/docrepository/summary.config”
        virtualShare=”true”
        type=”EPiServer.FileSystem.Handler.VersioningFileSystem,EPiServer”>

        <customSettings
            FilePath=”/docrepository/”
            MaxVersions=”7” />
    </handler>
</UnifiedFileSystem>

In docrepository/summary.config:

Sample script (in this sample there is only one property defined to increase the readability of the script)

<root xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <model>
        <instance>
            <Author />
            </instance>
    </model>
<table id="id_matrix" border="0">
    <tr>
        <td valign="top" width="100" height="10">
            <span id="id_field1">Author</span>
        </td>
        <td valign="top" width="200" height="10">
            <xforms:input ref="Author" value="" id="id_field2" size="40" />
        </td>
    </tr>
</table>
</root>

EPiTrace logger