IHierarchyItem.Delete Method ()

IT Hit WebDAV for .NET

Deletes this item.

[Visual Basic]
Sub Delete()
[C#]
void Delete();

Exceptions

Exception Type Condition
LockedException This folder or any child item is locked and no or invalid lock token was specified.
ForbiddenException User has not enough rights to perform this operation.
MethodNotAllowedException Trying to delete lock-null item. Lock-null items must be deleted using Unlock method.
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/Library"));

 try
 {
     folder.Delete();
 }
 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

IHierarchyItem Interface | ITHit.WebDAV.Client Namespace | IHierarchyItem.Delete Overload List