Click or drag to resize

IHierarchyItemAsyncRefreshLockAsync Method

IT Hit WebDAV Classes Reference
Prolongs the lock.

Namespace:  ITHit.WebDAV.Client
Assembly:  ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll) Version: 2.0.420.0
Syntax
Task<LockInfo> RefreshLockAsync(
	string lockToken,
	Nullable<TimeSpan> timeout
)

Parameters

lockToken
Type: SystemString
Identifies lock to be prolonged.
timeout
Type: SystemNullableTimeSpan
New timeout to set.

Return Value

Type: TaskLockInfo
Instance of LockInfo with information about refreshed lock.
Exceptions
ExceptionCondition
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.
NotFoundExceptionThis item doesn't exist on the server.
WebDavHttpExceptionServer returned unknown error.
WebDavExceptionUnexpected error occurred.
Remarks
Server can set lock with different timeout than the one was asked.
Examples
string license = "<?xml version='1.0' encoding='utf...
WebDavSessionAsync session = new WebDavSessionAsync(license);
session.Credentials = new NetworkCredential("User1", "pwd");
IHierarchyItemAsync item = await session.OpenFileAsync(new Uri("http://server:8580/Products/Sales.txt"));

LockInfo lockInfo = await item.LockAsync(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 = await item.RefreshLockAsync(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