ILockAsyncGetActiveLocksAsync Method
IT Hit WebDAV Classes Reference
Gets the IEnumerableT with all locks for this item.
Namespace:
ITHit.WebDAV.Server.Class2
Assembly:
ITHit.WebDAV.Server (in ITHit.WebDAV.Server.dll) Version: 11.3.10719
Syntax Task<IEnumerable<LockInfo>> GetActiveLocksAsync()
Task<IEnumerable<LockInfo>> GetActiveLocksAsync()
Function GetActiveLocksAsync As Task(Of IEnumerable(Of LockInfo))
Function GetActiveLocksAsync As Task(Of IEnumerable(Of LockInfo))
Task<IEnumerable<LockInfo^>^>^ GetActiveLocksAsync()
Task<IEnumerable<LockInfo^>^>^ GetActiveLocksAsync()
abstract GetActiveLocksAsync : unit -> Task<IEnumerable<LockInfo>>
abstract GetActiveLocksAsync : unit -> Task<IEnumerable<LockInfo>>
Return Value
Type:
TaskIEnumerableLockInfo
.
Exceptions Remarks
This property must return all locks for the item including deep locks on any of the parent folders.
Examples The code below is part of 'WebDAVServer.FileSystemStorage.AspNet' C# & VB samples provided with the SDK.
public async Task<IEnumerable<LockInfo>> GetActiveLocksAsync()
{
List<DateLockInfo> locks = await GetLocksAsync();
if (locks == null)
{
return new List<LockInfo>();
}
IEnumerable<LockInfo> lockInfoList = locks.Select(l => new LockInfo
{
IsDeep = l.IsDeep,
Level = l.Level,
Owner = l.ClientOwner,
LockRoot = l.LockRoot,
TimeOut = l.Expiration == DateTime.MaxValue ?
TimeSpan.MaxValue :
l.Expiration - DateTime.UtcNow,
Token = l.LockToken
}).ToList();
return lockInfoList;
}
Public Async Function GetActiveLocksAsync() As Task(Of IEnumerable(Of LockInfo)) Implements ILockAsync.GetActiveLocksAsync
Dim locks As List(Of DateLockInfo) = Await GetLocksAsync()
If locks Is Nothing Then
Return New List(Of LockInfo)()
End If
Dim lockInfoList As IEnumerable(Of LockInfo) = locks.Select(Function(l) New LockInfo With {.IsDeep = l.IsDeep,
.Level = l.Level,
.Owner = l.ClientOwner,
.LockRoot = l.LockRoot,
.TimeOut = If(l.Expiration = DateTime.MaxValue, TimeSpan.MaxValue, l.Expiration - DateTime.UtcNow),
.Token = l.LockToken
}).ToList()
Return lockInfoList
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