Click or drag to resize

DavContextBaseGetHierarchyItem Method

IT Hit WebDAV Classes Reference
Implementation of this abstract method is used by WebDAV engine to find hierarchy item objects by path.

Namespace: ITHit.WebDAV.Server
Assembly: ITHit.WebDAV.Server (in ITHit.WebDAV.Server.dll) Version: 4.5.3121.0
public abstract IHierarchyItem GetHierarchyItem(
	string path


Type: SystemString
Path of the hierarchy item object. It is always the full path from the root of the WebDAV repository.

Return Value

Type: IHierarchyItem
Hierarchy item object referenced by the specified path or null if hierarchy item not found.

When you inherit from the DavContext class, you must override this abstract method. For WebDAV Class 1 and Class 2 server in this method implementation you will search for file or folder in your storage by path provided and return it to WebDAV engine. For DeltaV server in addition to folder or file item you will return version and history items.


The code below is part of 'WebDAVServer.NtfsStorage' sample provided with the SDK.

public override IHierarchyItem GetHierarchyItem(string path)
    path = path.Trim(new[] { ' ', '/' });

    //remove query string.
    int ind = path.IndexOf('?');
    if (ind > -1)
        path = path.Remove(ind);

    IHierarchyItem item = null;

    item = DavFolder.GetFolder(this, path);
    if (item != null)
        return item;

    item = DavFile.GetFile(this, path);
    if (item != null)
        return item;

    logger.LogDebug("Could not find item that corresponds to path: " + path);

    return null; // no hierarchy item that corresponds to path parameter was found in the repository
See Also