Try our conversational search powered by Generative AI!

Class UnifiedDirectory

Base class for UnifiedDirectory and VirtualDirectory implementation. All basic events triggered by EPiServer UI actions are raised form this class.

A derived class can choose to call the base class if it wants events to be raised in addition to raising own implemented events.

Inheritance
System.Object
UnifiedDirectory
Namespace: EPiServer.Web.Hosting
Assembly: EPiServer.dll
Version: 7.19.2
Syntax
public abstract class UnifiedDirectory : VirtualDirectory

Constructors

UnifiedDirectory(VirtualPathUnifiedProvider, String, String, Boolean)

Initializes a new instance of the UnifiedDirectory class.

Declaration
public UnifiedDirectory(VirtualPathUnifiedProvider provider, string virtualPath, string customSummaryVirtualPath, bool bypassAccessCheck)
Parameters
Type Name Description
VirtualPathUnifiedProvider provider

The provider this directory is served by

System.String virtualPath

Virtual Path to directory.

System.String customSummaryVirtualPath

virtual path to custom summary file.

System.Boolean bypassAccessCheck

Directory is a virtualshare.

Properties

ACL

Gets the AccessControlList for the direcory. This is mainly used by FileManager to support administration of access rights. To perform access checks the methods QueryDistinctAccess and QueryAccess should be used instead.

Declaration
public virtual AccessControlList ACL { get; }
Property Value
Type Description
AccessControlList

The ACL.

BypassAccessCheck

Gets or set a value indicating whether to bypass access check for directory.

Declaration
public virtual bool BypassAccessCheck { get; set; }
Property Value
Type Description
System.Boolean

true if bypass access check; otherwise, false.

Children

Implementing class shall NOT apply filtering in this property.

Declaration
public override IEnumerable Children { get; }
Property Value
Type Description
System.Collections.IEnumerable

ContentLoader

The IContentLoader instance the consumer should use / is using

Declaration
public Injected<IContentLoader> ContentLoader { get; set; }
Property Value
Type Description
Injected<IContentLoader>

ContentProviderManager

Gets the page provider manager used by the current instance.

Declaration
public Injected<IContentProviderManager> ContentProviderManager { get; set; }
Property Value
Type Description
Injected<IContentProviderManager>

CustomFileSummaryVirtualPath

Full path to custom file summary XForm file.

Declaration
public virtual string CustomFileSummaryVirtualPath { get; }
Property Value
Type Description
System.String

Directories

Implementing class shall NOT apply filtering in this property.

Declaration
public override IEnumerable Directories { get; }
Property Value
Type Description
System.Collections.IEnumerable

Files

Implementing class shall NOT apply filtering in this property.

Declaration
public override IEnumerable Files { get; }
Property Value
Type Description
System.Collections.IEnumerable

IsAccessControlListSupported

Used internally to determine whether the directory supports changes to the access control list. Please do not override this property in your implementation as this behaviour is likely to change in the future.

Declaration
public virtual bool IsAccessControlListSupported { get; }
Property Value
Type Description
System.Boolean

IsFirstLevel

Base implementation looks at the virtual path for slashes to determine level in directory tree semantics. If no slashes > 1 its NOT a top level.

Declaration
public virtual bool IsFirstLevel { get; }
Property Value
Type Description
System.Boolean

IsVersioningSupported

Base class always returns false.

Declaration
public virtual bool IsVersioningSupported { get; }
Property Value
Type Description
System.Boolean

PageQuickSearch

Gets the page quick search used by the current instance.

Declaration
public Injected<IPageQuickSearch> PageQuickSearch { get; set; }
Property Value
Type Description
Injected<IPageQuickSearch>

Parent

Gets the parent for this directory

Declaration
public virtual UnifiedDirectory Parent { get; }
Property Value
Type Description
UnifiedDirectory

The parent.

Provider

Referens to the provider which where responsible for returning this instance of VirtualDirectory.

Declaration
public VirtualPathUnifiedProvider Provider { get; }
Property Value
Type Description
VirtualPathUnifiedProvider

VirtualPath

Gets the VirtualFile VirtualPath. This property is sealed for the reason to avoid implemetations to work around the base functionallity of the VPP API.

Declaration
public string VirtualPath { get; }
Property Value
Type Description
System.String

Methods

CopyTo(String)

Copies the file to a new virtual path

Declaration
public virtual void CopyTo(string newVirtualPath)
Parameters
Type Name Description
System.String newVirtualPath

The new virtual path.

CreateDirectory(String)

Creates a UnifiedDirectory from a virtualPath. This creation is base upon a VirtualPathProvider finds the virtualPath valid and returns a directory somewhere in path to work on.

Declaration
public static UnifiedDirectory CreateDirectory(string virtualPath)
Parameters
Type Name Description
System.String virtualPath

VirtualPath to create.

Returns
Type Description
UnifiedDirectory

UnifiedDirectory class implementation of the virtualpath.

CreateFile(String)

Creates a file in current directory

Declaration
public virtual UnifiedFile CreateFile(string name)
Parameters
Type Name Description
System.String name

The name.

Returns
Type Description
UnifiedFile

CreateFile(String, Guid)

Creates a file in current directory with a specified id

Declaration
public virtual UnifiedFile CreateFile(string name, Guid id)
Parameters
Type Name Description
System.String name

The name.

System.Guid id

The id.

Returns
Type Description
UnifiedFile

CreateSubdirectory(String)

Base class implementation performs access check and then delegates to CreateSubdirectoryInternal(String) or CreateSubdirectory(String, PageData) in case of creating a page folder.

Declaration
public virtual UnifiedDirectory CreateSubdirectory(string path)
Parameters
Type Name Description
System.String path

The path.

Returns
Type Description
UnifiedDirectory

CreateSubdirectoryInternal(String)

Creates a subdirectory. Base class does not implement this method but throws NotSupportedException

Declaration
protected virtual UnifiedDirectory CreateSubdirectoryInternal(string path)
Parameters
Type Name Description
System.String path

The path.

Returns
Type Description
UnifiedDirectory

Delete()

Deletes this instance.

Declaration
public virtual void Delete()

DeleteUnifiedPathsRecursively()

Iterates over all sub direcotries and files and deletes the UnifiedPathInfo for it, if it exist

Declaration
protected void DeleteUnifiedPathsRecursively()

FilterDirectoryList(List<UnifiedDirectory>, IUnifiedFilter)

Filters a list only containing UnifiedDirectory using the supplied filter.

Declaration
protected virtual void FilterDirectoryList(List<UnifiedDirectory> directories, IUnifiedFilter filter)
Parameters
Type Name Description
System.Collections.Generic.List<UnifiedDirectory> directories

List of UnifiedDirectory objects to filter

IUnifiedFilter filter

Filter to use on list

FilterFileList(List<UnifiedFile>, IUnifiedFilter)

Filters a list only containing UnifiedFile objects using the supplied filter.

Declaration
protected virtual void FilterFileList(List<UnifiedFile> files, IUnifiedFilter filter)
Parameters
Type Name Description
System.Collections.Generic.List<UnifiedFile> files

List of UnifiedDirectory objects to filter

IUnifiedFilter filter

Filter to use on list

FilterUnifiedList(List<Object>, IUnifiedFilter)

Filters a list of children containing both UnifiedFile and UnifiedDirectory objects (All other types are left untouched) using the supplied filter. The filter must implement AcceptFile and AcceptDirectory methods and returns false if the object isn't accepted and shall be removed from list.

Declaration
protected virtual void FilterUnifiedList(List<object> children, IUnifiedFilter filter)
Parameters
Type Name Description
System.Collections.Generic.List<System.Object> children
IUnifiedFilter filter

GetDirectories()

Implementing class SHALL apply filtering in this method.

Declaration
public virtual UnifiedDirectory[] GetDirectories()
Returns
Type Description
UnifiedDirectory[]

GetDirectoryNameFromVirtualPath(String)

Gets the directory name from a virtual path. Example returns "myfolder" from "/EpiServerSample/opload/myfolder/".

Declaration
public static string GetDirectoryNameFromVirtualPath(string virtualPath)
Parameters
Type Name Description
System.String virtualPath
Returns
Type Description
System.String

GetFiles()

Implementing class SHALL apply filtering in this method.

Declaration
public virtual UnifiedFile[] GetFiles()
Returns
Type Description
UnifiedFile[]

GetOwnerContentFromVirtualPath(String)

Gets the owner content from virtual path.

Declaration
public static IContent GetOwnerContentFromVirtualPath(string virtualPath)
Parameters
Type Name Description
System.String virtualPath

The virtual path.

Returns
Type Description
IContent

GetOwnerContentFromVirtualPath(String, IContentLoader, IContentProviderManager, IPageQuickSearch)

Gets the owner content from virtual path.

Declaration
public static IContent GetOwnerContentFromVirtualPath(string virtualPath, IContentLoader contentQueryable, IContentProviderManager contentProviderManager, IPageQuickSearch pageQuickSearch)
Parameters
Type Name Description
System.String virtualPath

The virtual path.

IContentLoader contentQueryable

The IContentRepository instance to use

IContentProviderManager contentProviderManager

The page enterprise service.

IPageQuickSearch pageQuickSearch

The page quick search.

Returns
Type Description
IContent

GetOwnerPageFromVirtualPath(String)

Gets the owner page from virtual path.

Declaration
[Obsolete("Use GetOwnerContentFromVirtualPath instead")]
public static PageData GetOwnerPageFromVirtualPath(string virtualPath)
Parameters
Type Name Description
System.String virtualPath

The virtual path.

Returns
Type Description
PageData

GetTranslatedPath()

Gets a translated path to the directory.

Declaration
public virtual string GetTranslatedPath()
Returns
Type Description
System.String

The localized version of the path.

Remarks

For instance ~/global/logotypes would in a standard installation result in "Global files/logotypes" for english users since the root has the translation "Global files".

MoveTo(String)

Moves the file to a new virtual path

Declaration
public virtual void MoveTo(string newVirtualPath)
Parameters
Type Name Description
System.String newVirtualPath

The new virtual path.

OnAclSaved(UnifiedVirtualPathEventArgs)

Base implementation on raised event for acl changes on directories.

Declaration
protected virtual void OnAclSaved(UnifiedVirtualPathEventArgs e)
Parameters
Type Name Description
UnifiedVirtualPathEventArgs e

OnAdded(UnifiedVirtualPathEventArgs)

Base implementation on reaised event for added directories.

Declaration
protected virtual void OnAdded(UnifiedVirtualPathEventArgs e)
Parameters
Type Name Description
UnifiedVirtualPathEventArgs e

OnAdding(UnifiedVirtualPathEventArgs)

Base implementation on reaised event for adding directories.

Declaration
protected virtual void OnAdding(UnifiedVirtualPathEventArgs e)
Parameters
Type Name Description
UnifiedVirtualPathEventArgs e

OnCopied(UnifiedVirtualPathEventArgs)

Base implementation on reaised event for copied directories.

Declaration
protected virtual void OnCopied(UnifiedVirtualPathEventArgs e)
Parameters
Type Name Description
UnifiedVirtualPathEventArgs e

OnCopying(UnifiedVirtualPathEventArgs)

Base implementation on reaised event for copying directories.

Declaration
protected virtual void OnCopying(UnifiedVirtualPathEventArgs e)
Parameters
Type Name Description
UnifiedVirtualPathEventArgs e

OnDeleted(UnifiedVirtualPathEventArgs)

Base implementation on reaised event for deleted directories.

Declaration
protected virtual void OnDeleted(UnifiedVirtualPathEventArgs e)
Parameters
Type Name Description
UnifiedVirtualPathEventArgs e

OnDeleting(UnifiedVirtualPathEventArgs)

Base implementation on reaised event for deleting directories.

Declaration
protected virtual void OnDeleting(UnifiedVirtualPathEventArgs e)
Parameters
Type Name Description
UnifiedVirtualPathEventArgs e

OnFileAdded(UnifiedVirtualPathEventArgs)

Base implementation on reaised event for added directories.

Declaration
protected virtual void OnFileAdded(UnifiedVirtualPathEventArgs e)
Parameters
Type Name Description
UnifiedVirtualPathEventArgs e

OnFileAdding(UnifiedVirtualPathEventArgs)

Base implementation on reaised event for adding directories.

Declaration
protected virtual void OnFileAdding(UnifiedVirtualPathEventArgs e)
Parameters
Type Name Description
UnifiedVirtualPathEventArgs e

OnMoved(UnifiedVirtualPathEventArgs)

Base implementation on reaised event for renamed directories.

Declaration
protected virtual void OnMoved(UnifiedVirtualPathEventArgs e)
Parameters
Type Name Description
UnifiedVirtualPathEventArgs e

OnMoving(UnifiedVirtualPathEventArgs)

Base implementation on reaised event for renaming directories.

Declaration
protected virtual void OnMoving(UnifiedVirtualPathEventArgs e)
Parameters
Type Name Description
UnifiedVirtualPathEventArgs e

QueryAccess()

Gets the access level for the current user on this folder.

Declaration
public virtual AccessLevel QueryAccess()
Returns
Type Description
AccessLevel

The access level.

QueryDistinctAccess(AccessLevel)

Query if a user has access level on the current folder.

Declaration
public virtual bool QueryDistinctAccess(AccessLevel access)
Parameters
Type Name Description
AccessLevel access

The required access level.

Returns
Type Description
System.Boolean

Search(UnifiedSearchQuery)

Base implementation returns an empty search hit collection.

Declaration
public virtual UnifiedSearchHitCollection Search(UnifiedSearchQuery query)
Parameters
Type Name Description
UnifiedSearchQuery query
Returns
Type Description
UnifiedSearchHitCollection

SetContentForAccessControl(ContentReference)

Method that admits control of which content to perform access control against.

Declaration
public void SetContentForAccessControl(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The page to check access against

SetPageForAccessControl(PageReference)

Declaration
[Obsolete("Use SetContentForAccessControl instead")]
public void SetPageForAccessControl(PageReference pageReference)
Parameters
Type Name Description
PageReference pageReference

TryParsePageFolder(String, out Int32)

Tries to parse the page folder from the given virtualPath

Declaration
public static bool TryParsePageFolder(string virtualPath, out int pageFolderId)
Parameters
Type Name Description
System.String virtualPath

The virtual path to parse

System.Int32 pageFolderId

The page folder id

Returns
Type Description
System.Boolean

true if virtual path was a semantically correct virtualpath and the pagefolder id could be located. Else false.

Remarks

No check is made that the folder actually exists. It is a semantically check

UnInitialize()

Detach all event handlers from UnifiedDirectory.

Declaration
public static void UnInitialize()

Events

UnifiedDirectoryAclSaved

Raised when the access rights for a directory has been saved.

Declaration
public static event UnifiedDirectoryEventHandler UnifiedDirectoryAclSaved
Event Type
Type Description
UnifiedDirectoryEventHandler

UnifiedDirectoryAdded

Raised when a directory is added.

Declaration
public static event UnifiedDirectoryEventHandler UnifiedDirectoryAdded
Event Type
Type Description
UnifiedDirectoryEventHandler

UnifiedDirectoryAdding

Raised when a directory is about to be added.

Declaration
public static event UnifiedDirectoryEventHandler UnifiedDirectoryAdding
Event Type
Type Description
UnifiedDirectoryEventHandler

UnifiedDirectoryCopied

Raised when a directory is copied.

Declaration
public static event UnifiedDirectoryEventHandler UnifiedDirectoryCopied
Event Type
Type Description
UnifiedDirectoryEventHandler

UnifiedDirectoryCopying

Raised when a directory is about to be copied.

Declaration
public static event UnifiedDirectoryEventHandler UnifiedDirectoryCopying
Event Type
Type Description
UnifiedDirectoryEventHandler

UnifiedDirectoryDeleted

Raised when a directory is deleted.

Declaration
public static event UnifiedDirectoryEventHandler UnifiedDirectoryDeleted
Event Type
Type Description
UnifiedDirectoryEventHandler

UnifiedDirectoryDeleting

Raised when a directory is about to be deleted.

Declaration
public static event UnifiedDirectoryEventHandler UnifiedDirectoryDeleting
Event Type
Type Description
UnifiedDirectoryEventHandler

UnifiedDirectoryMoved

Raised when a directory is moved.

Declaration
public static event UnifiedDirectoryEventHandler UnifiedDirectoryMoved
Event Type
Type Description
UnifiedDirectoryEventHandler

UnifiedDirectoryMoving

Raised when a directory is about to be moved.

Declaration
public static event UnifiedDirectoryEventHandler UnifiedDirectoryMoving
Event Type
Type Description
UnifiedDirectoryEventHandler

UnifiedFileAdded

Raised when a file is added in a directory.

Declaration
public static event UnifiedDirectoryEventHandler UnifiedFileAdded
Event Type
Type Description
UnifiedDirectoryEventHandler

UnifiedFileAdding

Raised when a file is about to be added.

Declaration
public static event UnifiedDirectoryEventHandler UnifiedFileAdding
Event Type
Type Description
UnifiedDirectoryEventHandler

Extension Methods