Click or drag to resize

DavContextBaseAsyncGetHierarchyItemAsync 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: 7.1.4620
Syntax
public abstract Task<IHierarchyItemAsync> GetHierarchyItemAsync(
	string path
)

Parameters

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: TaskIHierarchyItemAsync
Hierarchy item object referenced by the specified path or null if hierarchy item not found.
Remarks

When you inherit from the WebDAV Context 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.

Examples

The code below is part of 'WebDAVServer.FileSystemStorage.AspNet' C# & VB samples provided with the SDK.

public override async Task<IHierarchyItemAsync> GetHierarchyItemAsync(string path)
{
    path = path.Trim(new[] { ' ', '/' });

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

    IHierarchyItemAsync item = null;

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

    item = await DavFile.GetFileAsync(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