Click or drag to resize

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()

Return Value

Type: TaskIEnumerableLockInfo
.
Exceptions
ExceptionCondition
NeedPrivilegesExceptionThe user doesn't have enough privileges.
DavExceptionIn other cases.
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;
}
See Also