I'm trying to import contact information from a database into a Public Folder
Contactlist using PROPPATCH, however I keep getting the error "Bad Request"
regardless of how much or little information I put in the XML.
I've pasted the short code for trying to create a new contact in the public
folder "test" below. Any help would be greatly appreciated.
' Declare the variables that you will use.
Dim objRequest
Dim strBody As String
Dim strURL As String
' Specify the URL of the new object that you will create.
strURL = "http://texas/public/test/"
' Create an HTTP request object.
objRequest = CreateObject("MSXML2.ServerXMLHTTP")
strBody = "" & _
"
xmlns:e=""http://schemas.microsoft.com/exchange/"">" & _
"" & _
"" & _
"urn:content-classes:person" & _
"IPM.Contact" & _
"JoLynn" & _
"Julie" & _
"Dobney" & _
"JoLynn J. Dobney" & _
"Dobney, JoLynn" & _
"" & _
"" & _
""
' Open the request object and assign the PROPPATCH method to it.
objRequest.open("PROPPATCH", strURL, False, username, password)
' Set the required headers for the request.
objRequest.setRequestHeader("Content-Type", "text/xml")
objRequest.setRequestHeader("Translate", "F")
objRequest.setRequestHeader("Content-Length", Len(strBody))
' Send the request. Use the XML document as the body.
Try
objRequest.send(strBody)
'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 do not have permission to do the job. " & _
"Please check your permissions on this item.")
Else
MsgBox("Request Failed. Results = " & objRequest.Status & _
": " & objRequest.statusText)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
objRequest = Nothing
Archived from group: microsoft>public>exchange2000>development