IFolderCreateLockNullAsync Method (String, TimeSpan, String, Boolean, IDictionaryString, String, CancellationToken)
IT Hit WebDAV Classes Reference
Locks name for later use.
Namespace:
ITHit.WebDAV.Client
Assembly:
ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll) Version: 6.0.4052-Beta
Syntax Task<LockInfo> CreateLockNullAsync(
string newItemName,
TimeSpan timeout,
string lockToken,
bool deep,
IDictionary<string, string> headers = null,
CancellationToken cancellationToken = null
)
Function CreateLockNullAsync (
newItemName As String,
timeout As TimeSpan,
lockToken As String,
deep As Boolean,
Optional headers As IDictionary(Of String, String) = Nothing,
Optional cancellationToken As CancellationToken = Nothing
) As Task(Of LockInfo)
Task<LockInfo^>^ CreateLockNullAsync(
String^ newItemName,
TimeSpan timeout,
String^ lockToken,
bool deep,
IDictionary<String^, String^>^ headers = nullptr,
CancellationToken cancellationToken = nullptr
)
abstract CreateLockNullAsync :
newItemName : string *
timeout : TimeSpan *
lockToken : string *
deep : bool *
?headers : IDictionary<string, string> *
?cancellationToken : CancellationToken
(* Defaults:
let _headers = defaultArg headers null
let _cancellationToken = defaultArg cancellationToken null
*)
-> Task<LockInfo>
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. - headers (Optional)
- Type: System.Collections.GenericIDictionaryString, String
Request headers. - cancellationToken (Optional)
- Type: System.ThreadingCancellationToken
Propagates notification that operations should be canceled.
Return Value
Type:
TaskLockInfoInstance of
LockInfo with information about created lock.
Exceptions 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
[!:IHierarchyItem.DeleteAsync()] method, call
[!:IHierarchyItem.UnlockAsync(string)] instead.
Examples string license = "<?xml version='1.0' encoding='utf...
WebDavSession session = new WebDavSession(license);
session.Credentials = new NetworkCredential("User1", "pwd");
IFolder folder = await session.GetFolderAsync(new Uri("https://server:8080/Sales"));
LockInfo lockInfo = await folder.CreateLockNullAsync("file1.gif",
TimeSpan.FromMinutes(5), "locktoken", false);
Uri RemoteStorageUri = new Uri("https://server:8080/Sales/file1.gif");
LockUriTokenPair[] lockTokens = new LockUriTokenPair[] { new LockUriTokenPair(RemoteStorageUri, lockInfo.LockToken.LockToken) };
IFile file = await folder.CreateFileAsync("file1.gif", lockTokens);
await file.UnlockAsync(lockTokens);
See Also