Click or drag to resize

ILockGetActiveLocksAsync 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: 13.3.13068
Task<IEnumerable<LockInfo>> GetActiveLocksAsync()

Return Value

Type: TaskIEnumerableLockInfo
NeedPrivilegesExceptionThe user doesn't have enough privileges.
DavExceptionIn other cases.
This property must return all locks for the item including deep locks on any of the parent folders.

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

    return lockInfoList;
See Also