Click or drag to resize

IFolderCreateLockNull Method (String, LockScope, Boolean, String, TimeSpan)

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
LockInfo CreateLockNull(
	string newItemName,
	LockScope lockScope,
	bool deep,
	string owner,
	TimeSpan timeout
)

Parameters

newItemName
Type: SystemString
Name of new item.
lockScope
Type: ITHit.WebDAV.ClientLockScope
Scope of the lock.
deep
Type: SystemBoolean
Whether to lock entire subtree.
owner
Type: SystemString
Owner of the lock.
timeout
Type: SystemTimeSpan
TimeOut after which lock expires.

Return Value

Type: LockInfo
Instance of LockInfo with information about created lock.
Exceptions
ExceptionCondition
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 resource calling CreateFile(String) or converted to a folder calling CreateFolder(String). Lock-null items cannot be deleted using Delete method, call Unlock(String) instead.
Examples
string license = "<?xml version='1.0' encoding='utf...
WebDavSession session = new WebDavSession(license);
session.Credentials = new NetworkCredential("User1", "pwd");
IFolder folder = session.OpenFolder(new Uri("http://server:8080/Sales"));
LockInfo lockInfo = folder.CreateLockNull("file1.gif", 
    LockScope.Exclusive, true, "User 1", new TimeSpan(0, 30, 0)); // reserve name for future use
IFile file = folder.CreateFile("file1.gif", lockInfo.LockToken.LockToken); // convert lock-null to resource
file.Unlock(lockInfo.LockToken.LockToken);
See Also