Class FileSystemItem
Wrapper for UnifiedDirectory and UnifiedFile. The reason both classes are wrapped by same object is to able both items to be listed in same list in i.e. GridView.
Inheritance
Inherited Members
Namespace: EPiServer.Web.WebControls
Assembly: EPiServer.Web.WebControls.dll
Version: 7.19.2Syntax
public class FileSystemItem : IHierarchyData, IFileSystemItemConstructors
FileSystemItem(Object, FileSystemDataSource)
Item must be UnifiedFile or UnifiedDirectory
Declaration
public FileSystemItem(object item, FileSystemDataSource dataSource)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Object | item | UnifiedFile or UnifiedDirectory | 
| FileSystemDataSource | dataSource | FileSystemDataSource | 
Properties
Author
Only meaningful if wrapped item is UnifiedFile, for UnifiedDirectory this is string.Empty
Declaration
public string Author { get; }Property Value
| Type | Description | 
|---|---|
| System.String | 
Category
Only meaningful if wrapped item is UnifiedFile, for UnifiedDirectory this is string.Empty
Declaration
public string Category { get; }Property Value
| Type | Description | 
|---|---|
| System.String | 
Changed
Only meaningful if wrapped item is UnifiedFile, for UnifiedDirectory this is DateTime.MinValue
Declaration
public DateTime Changed { get; }Property Value
| Type | Description | 
|---|---|
| System.DateTime | 
Children
Children for this item
Declaration
public List<IHierarchyData> Children { get; }Property Value
| Type | Description | 
|---|---|
| System.Collections.Generic.List<System.Web.UI.IHierarchyData> | 
Comments
Only meaningful if wrapped item is UnifiedFile, for UnifiedDirectory this is string.Empty
Declaration
public string Comments { get; }Property Value
| Type | Description | 
|---|---|
| System.String | 
Created
Only meaningful if wrapped item is UnifiedFile, for UnifiedDirectory this is DateTime.MinValue
Declaration
public DateTime Created { get; }Property Value
| Type | Description | 
|---|---|
| System.DateTime | 
DataSource
The datasource this item is related to
Declaration
public FileSystemDataSource DataSource { get; }Property Value
| Type | Description | 
|---|---|
| FileSystemDataSource | 
HasChildren
Indicates if the wrapped item has any children
Declaration
public bool HasChildren { get; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
ImageUrl
Url for this item, change defualt images by eventhandler to FileSystemDataSource controls events ResolveDirectoryImageUrl and ResolveFileImageUrl
Declaration
public string ImageUrl { get; }Property Value
| Type | Description | 
|---|---|
| System.String | 
IsDirectory
States if this item wraps a directory
Declaration
public bool IsDirectory { get; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
IsFile
States if this item wraps a file
Declaration
public bool IsFile { get; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
Item
Gets the wrapped item, either a UnifiedFile or an UnifiedDirectory
Declaration
public object Item { get; }Property Value
| Type | Description | 
|---|---|
| System.Object | 
Keywords
Only meaningful if wrapped item is UnifiedFile, for UnifiedDirectory this is string.Empty
Declaration
public string Keywords { get; }Property Value
| Type | Description | 
|---|---|
| System.String | 
Length
Only meaningful if wrapped item is UnifiedFile, for UnifiedDirectory this is 0
Declaration
public long Length { get; }Property Value
| Type | Description | 
|---|---|
| System.Int64 | 
Name
The Name of the wrapped item
Declaration
public string Name { get; }Property Value
| Type | Description | 
|---|---|
| System.String | 
Path
The path for the wrapped item
Declaration
public string Path { get; }Property Value
| Type | Description | 
|---|---|
| System.String | 
Subject
Only meaningful if wrapped item is UnifiedFile, for UnifiedDirectory this is string.Empty
Declaration
public string Subject { get; }Property Value
| Type | Description | 
|---|---|
| System.String | 
Title
If wrapped item is UnifiedFile this is Title, if wrapped item is UnifiedDirectory this is same as Name
Declaration
public string Title { get; }Property Value
| Type | Description | 
|---|---|
| System.String | 
Type
A string representation of the wrapped items type
Declaration
public string Type { get; }Property Value
| Type | Description | 
|---|---|
| System.String | 
Methods
GetChildren()
Returns the children for this item
Declaration
public IHierarchicalEnumerable GetChildren()Returns
| Type | Description | 
|---|---|
| System.Web.UI.IHierarchicalEnumerable | IHierarchicalEnumerable | 
GetExtensionImage(String)
Gets the ImageUrl for a file extension. This method relies on Theming and therefore a page context must be in HttpContext.Current.Handler, otherwise an empty string is returned. This gives an app relative path as: ~/App_Themes/[Page Theme]/Images/Extensions/[Ext].gif
Declaration
public static string GetExtensionImage(string extension)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | extension | file extension | 
Returns
| Type | Description | 
|---|---|
| System.String | imageurl | 
GetFolderImage()
Returns the url to the folder image from ~/App_Themes/[Page Theme]/Images/ExplorerTree/FileTree/Folder.gif. If no Page context an emtpy string is returned.
Declaration
public static string GetFolderImage()Returns
| Type | Description | 
|---|---|
| System.String | 
GetParent()
Gets the parent for this item
Declaration
public IHierarchyData GetParent()Returns
| Type | Description | 
|---|---|
| System.Web.UI.IHierarchyData | parent | 
ToString()
This implemementation returns the Name of the wrapped item, used if bind to a TreeView and no explicit Text is specified
Declaration
public override string ToString()Returns
| Type | Description | 
|---|---|
| System.String | The name of the wrapped item | 
