Click or drag to resize

LockScope Enumeration

IT Hit WebDAV Classes Reference
Scope of the lock.

Namespace:  ITHit.WebDAV.Client
Assembly:  ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll) Version: 6.0.4052-Beta
Syntax
[SerializableAttribute]
public enum LockScope
Members
  Member nameValueDescription
Exclusive0 Exclusive lock.
Shared1 Shared lock.
Remarks
Represents exclusive or shared lock.
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:8580/Products/Sales.txt"));

LockInfo lockInfo = null;
try
{
    lockInfo = await item.LockAsync(LockScope.Shared, false, "User 1", TimeSpan.MaxValue);
}
catch (LockedException)
{
    Console.Write("The item is locked.");
}
catch (MethodNotAllowedException)
{
    Console.Write("The item does not alow locks.");
}
if (lockInfo!= null)
{
    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