/// <summary> /// Removes lock with the specified token from this item. /// </summary> /// <param name="lockToken">Lock with this token should be removed from the item.</param> 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.eventsService.NotifyRefreshAsync(GetParentPath(Path)); }