Click or drag to resize

IHierarchyItemMoveToAsync Method (IFolder, String, Boolean)

IT Hit WebDAV Classes Reference
Moves this item to another location.

Namespace:  ITHit.WebDAV.Client
Assembly:  ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll) Version: 6.0.4052-Beta
Syntax
Task MoveToAsync(
	IFolder destinationFolder,
	string destinationName,
	bool overwrite
)

Parameters

destinationFolder
Type: ITHit.WebDAV.ClientIFolder
Folder to move to.
destinationName
Type: SystemString
Name to assign to moved item.
overwrite
Type: SystemBoolean
Whether existing destination item shall be overwritten.

Return Value

Type: Task

[Missing <returns> documentation for "M:ITHit.WebDAV.Client.IHierarchyItem.MoveToAsync(ITHit.WebDAV.Client.IFolder,System.String,System.Boolean)"]

Exceptions
ExceptionCondition
ForbiddenException The source and destination URIs are the same.
ConflictException A resource cannot be created at the destination until one or more intermediate collections have been created.
PreconditionFailedException The destination resource exists and overwrite was false.
LockedException The destination folder or items to be overwritten were locked or source items were locked.
NotFoundExceptionThis item doesn't exist on the server.
WebDavHttpExceptionServer returned unknown error for specific resource.
WebDavExceptionUnexpected error occurred.
Examples
IFolder itemSrc = await session.GetFolderAsync(new Uri("https://server:8080/Library/"));
IFolder itemDst = await session.GetFolderAsync(new Uri("https://server:8080/Sales/"));
try
{
    await itemSrc.MoveToAsync(itemDst, itemSrc.DisplayName, false);
}
catch (PreconditionFailedException)
{
    Console.WriteLine("The destination item exists and 'overwrite' was 'false'.");
}
catch (WebDavHttpException ex)
{
    Console.WriteLine(ex.Message + " " + ex.Status.Code + " " + ex.Status.Description);
    foreach (IMultistatusResponse resp in ex.Multistatus.Responses)
    { // Find which items failed to move.
        Console.WriteLine(resp.Href + " " + resp.Status.Code + " " + resp.Status.Description);
    }
}
See Also