Namespace: ITHit.WebDAV.Client
Task<LockInfo> CreateLockNullAsync( string newItemName, LockScope lockScope, bool deep, string owner, TimeSpan timeout )
Exception | Condition |
---|---|
NotFoundException | This folder doesn't exist on the server.(Server in fact returns Conflict) |
LockedException | This folder is locked and no or invalid lock token was specified. |
ForbiddenException | The client, for reasons the server chooses not to specify, cannot apply the lock. |
WebDavHttpException | Server returned unknown error. |
WebDavException | Unexpected error occurred. |
string license = "<?xml version='1.0' encoding='utf... WebDavSessionAsync session = new WebDavSessionAsync(license); session.Credentials = new NetworkCredential("User1", "pwd"); IFolderAsync folder = await session.OpenFolderAsync(new Uri("http://server:8080/Sales")); LockInfo lockInfo = await folder.CreateLockNullAsync("file1.gif", LockScope.Exclusive, true, "User 1", new TimeSpan(0, 30, 0)); // reserve name for future use IFileAsync file = await folder.CreateFileAsync("file1.gif", lockInfo.LockToken.LockToken); // convert lock-null to resource await file.UnlockAsync(lockInfo.LockToken.LockToken);