Namespace: ITHit.WebDAV.Client
Task MoveToAsync( IFolderAsync destinationFolder, string destinationName, bool overwrite, LockUriTokenPair[] lockTokens )
[Missing <returns> documentation for "M:ITHit.WebDAV.Client.IHierarchyItemAsync.MoveToAsync(ITHit.WebDAV.Client.IFolderAsync,System.String,System.Boolean,ITHit.WebDAV.Client.LockUriTokenPair[])"]
Exception | Condition |
---|---|
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 or source items were locked. |
NotFoundException | This item doesn't exist on the server. |
WebDavHttpException | Server returned unknown error for specific resource. |
WebDavException | Unexpected error occurred. |
string license = "<?xml version='1.0' encoding='utf... WebDavSessionAsync session = new WebDavSessionAsync(license); session.Credentials = new NetworkCredential("User1", "pwd"); IFolderAsync itemSrc = await session.OpenFolderAsync(new Uri("http://server:8080/Library/")); IFolderAsync itemDst = await session.OpenFolderAsync(new Uri("http://server:8080/Sales/")); LockInfo lockInfo1 = await itemDst.LockAsync(LockScope.Shared, true, "User 1", new TimeSpan(0, 5, 0)); IHierarchyItemAsync file = await session.OpenFileAsync(new Uri("http://server:8080/Library/image007.gif")); LockInfo lockInfo2 = await file.LockAsync(LockScope.Exclusive, false, "User 1", new TimeSpan(0, 5, 0)); LockUriTokenPair[] locks = new LockUriTokenPair[2]; locks[0] = lockInfo1.LockToken; locks[1] = lockInfo2.LockToken; try { await itemSrc.MoveToAsync(itemDst, itemSrc.DisplayName, true, locks); } catch (WebDavHttpException ex) { Console.WriteLine(ex.Message + " " + ex.Status.Code + " " + ex.Status.Description); foreach (IMultistatusResponseAsync resp in ex.Multistatus.Responses) { // Find which items failed to move. Console.WriteLine(resp.Href + " " + resp.Status.Code + " " + resp.Status.Description); } }