Share via


Deleting a Contact from the Exchange Store (WebDAV)

Deleting a Contact from the Exchange Store (WebDAV)

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Deleting a contact involves removing the contact item from the Exchange store.

Example

The following example uses the DELETE Method to delete a contact for "JoLynn Dobney" from a user's Contacts folder in the Exchange store.

See Constructing Exchange Store HTTP URLs and Authentication and Security Using WebDAV for more information.

VBScript

' Declare variables to be used.
Dim objRequest 'As MSXML.XMLHTTPRequest
Dim strURL 'As String

' Specify the URL of the object to be deleted.
strURL = "https://ServerName/Exchange/UserName/Contacts/JoLynnDobney.eml"

' Create an HTTP request object.
Set objRequest = CreateObject("Microsoft.xmlhttp")

' Open the object, assigning it a method.
objRequest.open "DELETE", strURL, False, "UserName", "Password"

' Send the request, using the XML document as the body.
objRequest.send

'Display the results.
If (objRequest.Status >= 200 And objRequest.Status < 300) Then
    MsgBox "Success!   " & "Results = " & objRequest.Status & _
        ": " & objRequest.statusText
ElseIf objRequest.Status = 401 Then
    MsgBox "You don't have permission to delete the contact. " & _
        "Please check your permissions on this item."
ElseIf (objRequest.Status >= 500 And objRequest.Status < 600) Then
    MsgBox "An error occurred on the server."
Else
    MsgBox "Request Failed.  Results = " & objRequest.Status & _
        ": " & objRequest.statusText
End If

Set objRequest = Nothing

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.