Delete an Email / Appt WebDAV

Delete an Email / Appt WebDAV

use this piece of code to  delete an appt from an exchange server using webdav.

to delete email replace calendar with mail.

strCalendarUri = "https://" + strExchServerName + "/Exchange/" +
       strMailbox + "/Calendar/";

    
   
    // Create the HttpWebRequest object.
    DeleteRequest = HttpWebRequest.Create(strCalendarUri + ApptItem);
    if (DeleteRequest == null)
     return false;

    // Add the network credentials to the request.
    DeleteRequest.Credentials = //set credentials here;

    // Specify the DELETE method.
    DeleteRequest.Method = "DELETE";

    // Send the DELETE method request.
    DelResp = (System.Net.HttpWebResponse)DeleteRequest.GetResponse();

    // Close the HttpWebResponse object.
    DelResp.Close();