Click or drag to resize

IHierarchyItemGetParentAsync 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: 6.0.4052-Beta
Syntax
Task<IFolder> GetParentAsync()

Return Value

Type: TaskIFolder
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...
WebDavSession session = new WebDavSession(license);
session.Credentials = new NetworkCredential("User1", "pwd");
IFolder folderSrc = await session.GetFolderAsync(new Uri("https://server/My Folder/"));
IFolder 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