Click or drag to resize

IHierarchyItemAsyncGetParentAsync Method

IT Hit WebDAV Classes Reference
Retrieves parent hierarchy item of this item.

Namespace:  ITHit.WebDAV.Client
Assembly:  ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll) Version: 2.0.420.0
Syntax
Task<IFolderAsync> GetParentAsync()

Return Value

Type: TaskIFolderAsync
Parent hierarchy item of this item. Null for root item.
Exceptions
ExceptionCondition
NotFoundExceptionThis item doesn't exist on the server.
WebDavHttpExceptionServer returned unknown error.
WebDavExceptionUnexpected error occurred.
Examples

Renaming Item.

string license = "<?xml version='1.0' encoding='utf...
WebDavSessionAsync session = new WebDavSessionAsync(license);
session.Credentials = new NetworkCredential("User1", "pwd");
IFolderAsync folderSrc = await session.OpenFolderAsync(new Uri("http://server/My Folder/"));
IFolderAsync folderDst = await folderSrc.GetParentAsync();
try
{
    await folderSrc.MoveToAsync(folderDst, "My new name", false);
}
catch (PreconditionFailedException)
{
    Console.WriteLine("The folder with such name already exists and 'overwrite' was 'false'.");
}
See Also