IFolderItemExistsAsync Method
IT Hit WebDAV Classes Reference
Checks whether specified item exists in the folder.
Namespace:
ITHit.WebDAV.Client
Assembly:
ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll) Version: 6.0.4052-Beta
Syntax Task<bool> ItemExistsAsync(
string name,
IDictionary<string, string> headers = null,
CancellationToken cancellationToken = null
)
Function ItemExistsAsync (
name As String,
Optional headers As IDictionary(Of String, String) = Nothing,
Optional cancellationToken As CancellationToken = Nothing
) As Task(Of Boolean)
Task<bool>^ ItemExistsAsync(
String^ name,
IDictionary<String^, String^>^ headers = nullptr,
CancellationToken cancellationToken = nullptr
)
abstract ItemExistsAsync :
name : string *
?headers : IDictionary<string, string> *
?cancellationToken : CancellationToken
(* Defaults:
let _headers = defaultArg headers null
let _cancellationToken = defaultArg cancellationToken null
*)
-> Task<bool>
Parameters
- name
- Type: SystemString
Item's name - headers (Optional)
- Type: System.Collections.GenericIDictionaryString, String
Request headers. - cancellationToken (Optional)
- Type: System.ThreadingCancellationToken
Propagates notification that operations should be canceled.
Return Value
Type:
TaskBooleanTrue, if specified item exists; false, otherwise.
Examples string license = "<?xml version='1.0' encoding='utf...
WebDavSession session = new WebDavSession(license);
session.Credentials = new NetworkCredential("User1", "pwd");
IFolder srcFolder = await session.GetFolderAsync(new Uri("https://server:8080/Library/"));
bool isItemExists = await srcFolder.ItemExistsAsync("image.gif");
if(isItemExists)
Console.WriteLine("Item exists");
else
Console.WriteLine("Item not found");
See Also