ILockAsyncUnlockAsync Method
IT Hit WebDAV Classes Reference
Removes lock with the specified token from this item.
Namespace:
ITHit.WebDAV.Server.Class2
Assembly:
ITHit.WebDAV.Server (in ITHit.WebDAV.Server.dll) Version: 11.3.10719
Syntax Task UnlockAsync(
string lockToken
)
Task UnlockAsync(
string lockToken
)
Function UnlockAsync (
lockToken As String
) As Task
Function UnlockAsync (
lockToken As String
) As Task
Task^ UnlockAsync(
String^ lockToken
)
Task^ UnlockAsync(
String^ lockToken
)
abstract UnlockAsync :
lockToken : string -> Task
abstract UnlockAsync :
lockToken : string -> Task
Parameters
- lockToken
- Type: SystemString
Lock with this token should be removed from the item.
Return Value
Type:
Task
.
Exceptions Remarks
If this lock included more than one hierarchy item, the lock is removed from all items included in the lock.
Examples The code below is part of 'WebDAVServer.FileSystemStorage.AspNet' C# & VB samples provided with the SDK.
public async Task UnlockAsync(string lockToken)
{
if (string.IsNullOrEmpty(lockToken))
{
throw new DavException("Lock can not be found.", DavStatus.BAD_REQUEST);
}
List<DateLockInfo> locks = await GetLocksAsync(getAllWithExpired: true);
DateLockInfo lockInfo = locks.SingleOrDefault(x => x.LockToken == lockToken);
await RemoveExpiredLocksAsync(lockToken);
if (lockInfo == null || lockInfo.Expiration <= DateTime.UtcNow)
{
throw new DavException("The lock could not be found.", DavStatus.CONFLICT);
}
await context.socketService.NotifyUnLockedAsync(Path);
}
Public Async Function UnlockAsync(lockToken As String) As Task Implements ILockAsync.UnlockAsync
If String.IsNullOrEmpty(lockToken) Then
Throw New DavException("Lock can not be found.", DavStatus.BAD_REQUEST)
End If
Dim locks As List(Of DateLockInfo) = Await GetLocksAsync(getAllWithExpired:=True)
Dim lockInfo As DateLockInfo = locks.SingleOrDefault(Function(x) x.LockToken = lockToken)
Await RemoveExpiredLocksAsync(lockToken)
If lockInfo Is Nothing OrElse lockInfo.Expiration <= DateTime.UtcNow Then
Throw New DavException("The lock could not be found.", DavStatus.CONFLICT)
End If
Await context.socketService.NotifyUnLockedAsync(Path)
End Function
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also