IFolder.CreateLockNull Method (String, TimeSpan, String, Boolean)

IT Hit WebDAV for .NET

Locks name for later use.

[Visual Basic]
Function CreateLockNull( _
   ByVal newItemName As String, _
   ByVal timeout As TimeSpan, _
   ByVal lockToken As String, _
   ByVal deep As Boolean _
) As LockInfo
[C#]
LockInfo CreateLockNull(
   string newItemName,
   TimeSpan timeout,
   string lockToken,
   bool deep
);

Parameters

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

Return Value

Instance of LockInfo with information about created lock.

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 CreateResource or converted to a folder calling CreateFolder. Lock-null items cannot be deleted using Delete method, call Unlock instead.

Exceptions

Exception Type Condition
MethodNotAllowedException Item with specified name already exists.
NotFoundException This folder doesn't exist on the server.(Server in fact returns Conflict)
LockedException This folder is locked and no or invalid lock token was specified.
ForbiddenException The client, for reasons the server chooses not to specify, cannot apply the lock.
WebDavHttpException Server returned unknown error.
WebDavException Unexpected error occurred.

Example

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("resource1.gif",
    TimeSpan.FromMinutes(5), "locktoken", false); // reserve name for future use
IResource resource = folder.CreateResource("resource1.gif", "locktoken"); // convert lock-null to resource
resource.Unlock("locktoken");

See Also

IFolder Interface | ITHit.WebDAV.Client Namespace | IFolder.CreateLockNull Overload List