Namespace: ITHit.WebDAV.Client
Member name | Value | Description | |
---|---|---|---|
Exclusive | 0 | Exclusive lock. | |
Shared | 1 | Shared lock. |
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); }