Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with Error 400 - Bad Request

0 views
Skip to first unread message

Chcuk H

unread,
Feb 16, 2005, 4:49:22 PM2/16/05
to
I have been trying to update some OWA properties using PROPPATCH and I
keep getting an error 400 - Bad Request. Here is the code:

' Local vars
Dim objRequest As MSXML2.XMLHTTP40
Dim strMailbox As String
Dim strXMLNSInfo As String
Dim strXMLRequest As String

' Derive the name of the actual mailbox to update
strMailbox = strOWAServer & "/exchange/" & strAlias & "/"

' XML namespace info of the WebDAV request.
strXMLNSInfo = "xmlns:g=""DAV:"" " & _
"xmlns:e=""http://schemas.microsoft.com/exchange/"" " &
_
"xmlns:mapi=""http://schemas.microsoft.com/mapi/"" " & _

"xmlns:mapit=""http://schemas.microsoft.com/mapi/proptag/"" " & _

"xmlns:dt=""urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"" " & _
"xmlns:x=""xml:"">"

' Build the XML body of the PROPPATCH request
strXMLRequest = "<?xml version=""1.0""?>" & _
"<g:propertyupdate " & strXMLNSInfo & _
"<g:set>" & _
"<g:prop>" & _
"<e:viewrowcount dt:dt=""long"">25</e:viewrowcount>" &
_
"<e:timezone>" & strTimeZone & "</e:timezone>" & _
"<e:spellingcheckbeforesend
dt:dt=""boolean"">1</e:spellingcheckbeforesend>" & _

"<e:spellingdictionarylanguage>en-us</e:spellingdictionarylanguage>" &
_
"</g:prop>" & _
"</g:set>" & _
"</g:propertyupdate>"

' Create the DAV PROPPATCH request.
Set objRequest = CreateObject("Microsoft.XMLHTTP")
objRequest.Open "PROPPATCH", strMailbox, False, strUser, strPswd
objRequest.setRequestHeader "Content-Type", "text/xml"
objRequest.setRequestHeader "Content-Length", Len(strXMLRequest)

objRequest.send strXMLRequest
' Check for errors in update
If (objRequest.Status >= 200 And objRequest.Status < 300) Then
MsgBox strAlias & " has been updated successfully."
Else
MsgBox "Error: " & objRequest.Status & " - " &
objRequest.statusText
End If

' Release object reference
Set objRequest = Nothing


Here is an copy of the XML generated:

<?xml version="1.0"?>
<g:propertyupdate xmlns:g="DAV:"
xmlns:e="http://schemas.microsoft.com/exchange/"
xmlns:mapi="http://schemas.microsoft.com/mapi/"
xmlns:mapit="http://schemas.microsoft.com/mapi/proptag/"
xmlns:dt="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"
xmlns:x="xml:">
<g:set>
<g:prop>
<e:viewrowcount dt:dt="long">25</e:viewrowcount>
<e:timezone>Eastern Standard Time</e:timezone>
<e:spellingcheckbeforesend
dt:dt="boolean">1</e:spellingcheckbeforesend>
<e:spellingdictionarylanguage>en-us</e:spellingdictionarylanguage>
</g:prop>
</g:set>
</g:propertyupdate>

Any ideas why I would be getting the Bad Request error?

Thanks in advance

Glen Scales [MVP]

unread,
Feb 16, 2005, 11:49:54 PM2/16/05
to
The datatype for viewrowcount should be a integer not a long eg

<e:viewrowcount dt:dt=""int"">25</e:viewrowcount>

all the valid datatype mappings for xml are listed here
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_webstore_data_types.asp

Cheers
Glen

"Chcuk H" <pute...@bellsouth.net> wrote in message
news:1108590562....@f14g2000cwb.googlegroups.com...

Chuck H

unread,
Feb 17, 2005, 9:18:33 AM2/17/05
to
I changed the code to use "int" instead of "long" and I still get the
"Bad Request" error. Any other thoughts on how to debug this?

Thanks again.

Chuck H

unread,
Feb 17, 2005, 9:19:39 AM2/17/05
to

Chuck H

unread,
Feb 17, 2005, 5:18:08 PM2/17/05
to
Finally got everything to work. Big typo in the server name. Thanks
for everyones help.

0 new messages