Click or drag to resize

IHierarchyItemDeleteAsync Method (IDictionaryString, String, CancellationToken)

IT Hit WebDAV Classes Reference
Deletes this item.

Namespace:  ITHit.WebDAV.Client
Assembly:  ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll) Version: 6.0.4052-Beta
Syntax
Task DeleteAsync(
	IDictionary<string, string> headers = null,
	CancellationToken cancellationToken = null
)

Parameters

headers (Optional)
Type: System.Collections.GenericIDictionaryString, String
Request headers.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
Propagates notification that operations should be canceled.

Return Value

Type: Task

[Missing <returns> documentation for "M:ITHit.WebDAV.Client.IHierarchyItem.DeleteAsync(System.Collections.Generic.IDictionary{System.String,System.String},System.Threading.CancellationToken)"]

Exceptions
ExceptionCondition
LockedExceptionThis folder or any child item is locked and no or invalid lock token was specified.
ForbiddenExceptionUser has not enough rights to perform this operation.
MethodNotAllowedExceptionTrying to delete lock-null item. Lock-null items must be deleted using [!:IHierarchyItem.UnlockAsync(string)] method.
WebDavHttpExceptionServer returned unknown error.
WebDavExceptionUnexpected error occurred.
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/Library"));

try
{
   await folder.DeleteAsync();
}
catch(WebDavHttpException ex)
{ // Find which items failed to delete.
    Console.WriteLine(ex.Status.Code + " " + ex.Status.Description + " " + ex.Message);
    foreach(IMultistatusResponse resp in ex.Multistatus.Responses)
    {
        Console.WriteLine(resp.Href + " " + resp.Status.Code + " " + resp.Status.Description);
    }
}
See Also