WebDavSessionGetVersionAsync Method (Uri, IDictionaryString, String, CancellationToken)
IT Hit WebDAV Classes Reference
Namespace:
ITHit.WebDAV.Client
Assembly:
ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll) Version: 6.0.4052-Beta
Syntax public Task<IVersion> GetVersionAsync(
Uri path,
IDictionary<string, string> headers = null,
CancellationToken cancellationToken = null
)
Public Function GetVersionAsync (
path As Uri,
Optional headers As IDictionary(Of String, String) = Nothing,
Optional cancellationToken As CancellationToken = Nothing
) As Task(Of IVersion)
public:
virtual Task<IVersion^>^ GetVersionAsync(
Uri^ path,
IDictionary<String^, String^>^ headers = nullptr,
CancellationToken cancellationToken = nullptr
) sealed
abstract GetVersionAsync :
path : Uri *
?headers : IDictionary<string, string> *
?cancellationToken : CancellationToken
(* Defaults:
let _headers = defaultArg headers null
let _cancellationToken = defaultArg cancellationToken null
*)
-> Task<IVersion>
override GetVersionAsync :
path : Uri *
?headers : IDictionary<string, string> *
?cancellationToken : CancellationToken
(* Defaults:
let _headers = defaultArg headers null
let _cancellationToken = defaultArg cancellationToken null
*)
-> Task<IVersion>
Parameters
- path
- Type: SystemUri
Path to the version. - headers (Optional)
- Type: System.Collections.GenericIDictionaryString, String
Request headers. - cancellationToken (Optional)
- Type: System.ThreadingCancellationToken
Propagates notification that operations should be canceled.
Return Value
Type:
TaskIVersionVersion corresponding to requested path.
Implements
ISessionGetVersionAsync(Uri, IDictionaryString, String, CancellationToken)Exceptions Examples
The following example demonstrates how to restore specific version of the item.
string license = "<?xml version='1.0' encoding='utf...
WebDavSessionAsync session = new WebDavSessionAsync(license);
session.Credentials = new NetworkCredential("User1", "pwd");
IFile file = await session.GetFileAsync("https://server/sales.docx");
LockInfo lockInfo = await file.LockAsync(LockScope.Exclusive, false, "John Walter", TimeSpan.MaxValue);
IVersion version = await session.OpenVersionAsync(new Uri("https://server/sales.docx?version=2"));
await file.UpdateToVersionAsync(version, lockInfo.LockToken.LockToken);
await file.UnlockAsync(lockInfo.LockToken.LockToken);
See Also