IHierarchyItem.RefreshLock Method 

IT Hit WebDAV for .NET

Prolongs the lock.

[Visual Basic]
Function RefreshLock( _
   ByVal lockToken As String, _
   ByVal timeout As TimeSpan _
) As LockInfo
[C#]
LockInfo RefreshLock(
   string lockToken,
   TimeSpan timeout
);

Parameters

lockToken
Identifies lock to be prolonged.
timeout
New timeout to set.

Return Value

Instance of LockInfo with information about refreshed lock.

Remarks

Server can set lock with different timeout than the one was asked.

Exceptions

Exception Type Condition
PreconditionFailedException The included lock token was not enforceable on this resource or the server could not satisfy the request in the lockinfo XML element.
LockedException The resource is locked, so the method has been rejected.
NotFoundException This item doesn't exist on the server.
WebDavHttpException Server returned unknown error.
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:8580/Products/Sales.txt"));

 LockInfo lockInfo = item.Lock(LockScope.Exclusive, true, "User 1", new TimeSpan(0, 30, 0));
 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);

 lockInfo = item.RefreshLock(lockInfo.LockToken.LockToken, new TimeSpan(1, 00, 0));
 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