Click or drag to resize

IFolderAsyncCreateLockNullAsync Method (String, TimeSpan, String, Boolean)

IT Hit WebDAV Classes Reference
Locks name for later use.

Namespace:  ITHit.WebDAV.Client
Assembly:  ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll) Version: 2.0.420.0
Syntax
Task<LockInfo> CreateLockNullAsync(
	string newItemName,
	TimeSpan timeout,
	string lockToken,
	bool deep
)

Parameters

newItemName
Type: SystemString
Name of new item.
timeout
Type: SystemTimeSpan
TimeOut after which lock expires.
lockToken
Type: SystemString
Lock token for the lock.
deep
Type: SystemBoolean
Whether to lock entire subtree.

Return Value

Type: TaskLockInfo
Instance of LockInfo with information about created lock.
Exceptions
ExceptionCondition
MethodNotAllowedExceptionItem with specified name already exists.
NotFoundExceptionThis folder doesn't exist on the server.(Server in fact returns Conflict)
LockedExceptionThis folder is locked and no or invalid lock token was specified.
ForbiddenExceptionThe client, for reasons the server chooses not to specify, cannot apply the lock.
WebDavHttpExceptionServer returned unknown error.
WebDavExceptionUnexpected error occurred.
Remarks
Locks name for later use creating a lock-null item with a specified name. Later lock-null item could be converted to a file calling CreateFileAsync(String) or converted to a folder calling CreateFolderAsync(String). Lock-null items cannot be deleted using DeleteAsync method, call UnlockAsync(String) instead.
Examples
string license = "<?xml version='1.0' encoding='utf...
WebDavSessionAsync session = new WebDavSessionAsync(license);
session.Credentials = new NetworkCredential("User1", "pwd");
IFolderAsync folder = await session.OpenFolderAsync(new Uri("http://server:8080/Sales"));
LockInfo lockInfo = await folder.CreateLockNullAsync("file1.gif",
    TimeSpan.FromMinutes(5), "locktoken", false); // reserve name for future use
IFileAsync file = await folder.CreateFileAsync("file1.gif", "locktoken"); // convert lock-null to resource
await file.UnlockAsync("locktoken");
See Also