Click or drag to resize

IHierarchyItemGetActiveLocksAsync Method

IT Hit WebDAV Classes Reference

Note: This API is now obsolete.

Retrieves lock information about this item.

Namespace:  ITHit.WebDAV.Client
Assembly:  ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll) Version: 6.0.4052-Beta
Syntax
[ObsoleteAttribute]
Task<LockInfo[]> GetActiveLocksAsync(
	IDictionary<string, string> headers = null,
	CancellationToken cancellationToken = null
)

Parameters

headers (Optional)
Type: System.Collections.GenericIDictionaryString, String
Request headers.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
Propagates notification that operations should be canceled.

Return Value

Type: TaskLockInfo
Array of LockInfo objects representing locks.
Exceptions
ExceptionCondition
PropertyForbiddenExceptionUser has not enough rights to obtain one of requested properties.
PropertyConflictException The client has provided a value whose semantics are not appropriate for the property. This includes trying to set read-only properties.
PropertyExceptionServer returned unknown error.
NotFoundExceptionThis item doesn't exist on the server.
WebDavExceptionUnexpected error occurred.
Remarks
Empty array is returned if item was not locked.
Examples
string license = "<?xml version='1.0' encoding='utf...
WebDavSession session = new WebDavSession(license);
session.Credentials = new NetworkCredential("User1", "pwd");
IHierarchyItem item = await session.GetFileAsync(new Uri("https://server:8080/Products/Sales.txt"));
LockInfo[] activeLocks = await item.GetActiveLocksAsync();
foreach(LockInfo lockInfo in activeLocks)
{
    string timout = lockInfo.TimeOut == TimeSpan.MaxValue ? "Infinite" : lockInfo.TimeOut.TotalSeconds.ToString();
    Console.WriteLine(lockInfo.Owner 
        + " " + lockInfo.LockToken.Href 
        + " " + lockInfo.LockToken.LockToken 
        + " " + lockInfo.LockScope 
        + " " + lockInfo.Deep
        + " " + timout);
}
See Also