IHierarchyItem.GetActiveLocks Method 

IT Hit WebDAV for .NET

NOTE: This method is now obsolete.

Use ActiveLocks property instead.


Retrieves lock information about this item.

[Visual Basic]
Function GetActiveLocks() As LockInfo()
[C#]
LockInfo[] GetActiveLocks();

Return Value

Array of LockInfo objects representing locks.

Remarks

Empty array is returned if item was not locked.

Exceptions

Exception Type Condition
PropertyForbiddenException User 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.
PropertyException Server returned unknown error.
NotFoundException This item doesn't exist on the server.
WebDavException Unexpected error occurred.

Example

string license = "<?xml version='1.0' encoding='utf...
WebDavSession session = new WebDavSession(license);
session.Credentials = new NetworkCredential("User1", "pwd");
IHierarchyItem item = session.OpenResource(new Uri("http://server:8080/Products/Sales.txt"));
LockInfo[] activeLocks = item.GetActiveLocks();
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

IHierarchyItem Interface | ITHit.WebDAV.Client Namespace