Discussion:
Showing "Bad Request" when selecting particular appointment
(too old to reply)
Atul Saxena
2007-10-26 08:55:00 UTC
Permalink
I am doing following code:

Dim sQuery As String
Dim status As Integer
Dim oXMLHttp1 As MSXML2.XMLHTTP30 = New MSXML2.XMLHTTP30
Try

oXMLHttp1.open("SEARCH", stURI, False, Me.UserNameAlias,
Me.Password)

sQuery = "<?xml version='1.0' encoding= 'utf-8'?>" & _
"<a:searchrequest xmlns:a='DAV:'
xmlns:m='urn:schemas:mailheader:' xmlns:cal=""urn:schemas:calendar:""> " & _
"<a:sql>SELECT ""DAV:id"", ""DAV:getlastmodified"" " & _
"FROM Scope('SHALLOW TRAVERSAL OF """ & stURI & """')"
& _
"WHERE ""DAV:href"" = """ & strHref & """ " & _
"</a:sql>" & _
"</a:searchrequest>"


oXMLHttp1.setRequestHeader("Content-Type", "text/xml")
oXMLHttp1.setRequestHeader("Brief", "t")
' Send the query.
oXMLHttp1.send(sQuery)

status = CheckStatus(oXMLHttp1.status)
If status = En.enStatus.Multi_Status Then
MsgBox(oXMLHttp1.responseText)
End If

Catch ex As Exception
Throw New Exception(ex.Message, ex.InnerException)
Finally
sQuery = Nothing
status = Nothing
End Try

The value of sQuery contains:

<?xml version="1.0" encoding="utf-8" ?>
- <a:searchrequest xmlns:a="DAV:" xmlns:m="urn:schemas:mailheader:"
xmlns:cal="urn:schemas:calendar:">
<a:sql>SELECT "DAV:id", "DAV:getlastmodified" FROM Scope('SHALLOW
TRAVERSAL OF
"http://192.168.111.10/Exchange/***@ccrindia.com/Calendar/"')WHERE
"DAV:href" =
"http://192.168.111.10/Exchange/***@ccrindia.com/Calendar/No%20Appointment.EML"</a:sql>
</a:searchrequest>

but it is giving me "Bad Request" error where as appointment is present with
href
"http://192.168.111.10/Exchange/***@ccrindia.com/Calendar/No%20Appointment.EML".

Although If I remove where condition in Select clause then it shows all the
appointment including href
"http://192.168.111.10/Exchange/***@ccrindia.com/Calendar/No%20Appointment.EML".

Please suggest where I am doing wrong.

Thanks & regards,

Atul Saxena
Henning Krause [MVP - Exchange]
2007-10-27 17:38:03 UTC
Permalink
Hello,

DAV:href is a constructed property, you cannot search for it.

But since you already got the URL, just do a PROPFIND request on the
address.

Kind regards,
Henning Krause
Post by Atul Saxena
Dim sQuery As String
Dim status As Integer
Dim oXMLHttp1 As MSXML2.XMLHTTP30 = New MSXML2.XMLHTTP30
Try
oXMLHttp1.open("SEARCH", stURI, False, Me.UserNameAlias,
Me.Password)
sQuery = "<?xml version='1.0' encoding= 'utf-8'?>" & _
"<a:searchrequest xmlns:a='DAV:'
xmlns:m='urn:schemas:mailheader:' xmlns:cal=""urn:schemas:calendar:""> " & _
"<a:sql>SELECT ""DAV:id"", ""DAV:getlastmodified"" " & _
"FROM Scope('SHALLOW TRAVERSAL OF """ & stURI & """')"
& _
"WHERE ""DAV:href"" = """ & strHref & """ " & _
"</a:sql>" & _
"</a:searchrequest>"
oXMLHttp1.setRequestHeader("Content-Type", "text/xml")
oXMLHttp1.setRequestHeader("Brief", "t")
' Send the query.
oXMLHttp1.send(sQuery)
status = CheckStatus(oXMLHttp1.status)
If status = En.enStatus.Multi_Status Then
MsgBox(oXMLHttp1.responseText)
End If
Catch ex As Exception
Throw New Exception(ex.Message, ex.InnerException)
Finally
sQuery = Nothing
status = Nothing
End Try
<?xml version="1.0" encoding="utf-8" ?>
- <a:searchrequest xmlns:a="DAV:" xmlns:m="urn:schemas:mailheader:"
xmlns:cal="urn:schemas:calendar:">
<a:sql>SELECT "DAV:id", "DAV:getlastmodified" FROM Scope('SHALLOW
TRAVERSAL OF
"DAV:href" =
</a:searchrequest>
but it is giving me "Bad Request" error where as appointment is present with
href
Although If I remove where condition in Select clause then it shows all the
appointment including href
Please suggest where I am doing wrong.
Thanks & regards,
Atul Saxena
Atul Saxena
2007-10-29 04:04:00 UTC
Permalink
Thanks Henning, You are right, it is working fine with PROPFIND.

Thanks & regards,

Atul Saxena
Post by Henning Krause [MVP - Exchange]
Hello,
DAV:href is a constructed property, you cannot search for it.
But since you already got the URL, just do a PROPFIND request on the
address.
Kind regards,
Henning Krause
Post by Atul Saxena
Dim sQuery As String
Dim status As Integer
Dim oXMLHttp1 As MSXML2.XMLHTTP30 = New MSXML2.XMLHTTP30
Try
oXMLHttp1.open("SEARCH", stURI, False, Me.UserNameAlias,
Me.Password)
sQuery = "<?xml version='1.0' encoding= 'utf-8'?>" & _
"<a:searchrequest xmlns:a='DAV:'
xmlns:m='urn:schemas:mailheader:' xmlns:cal=""urn:schemas:calendar:""> " & _
"<a:sql>SELECT ""DAV:id"", ""DAV:getlastmodified"" " & _
"FROM Scope('SHALLOW TRAVERSAL OF """ & stURI & """')"
& _
"WHERE ""DAV:href"" = """ & strHref & """ " & _
"</a:sql>" & _
"</a:searchrequest>"
oXMLHttp1.setRequestHeader("Content-Type", "text/xml")
oXMLHttp1.setRequestHeader("Brief", "t")
' Send the query.
oXMLHttp1.send(sQuery)
status = CheckStatus(oXMLHttp1.status)
If status = En.enStatus.Multi_Status Then
MsgBox(oXMLHttp1.responseText)
End If
Catch ex As Exception
Throw New Exception(ex.Message, ex.InnerException)
Finally
sQuery = Nothing
status = Nothing
End Try
<?xml version="1.0" encoding="utf-8" ?>
- <a:searchrequest xmlns:a="DAV:" xmlns:m="urn:schemas:mailheader:"
xmlns:cal="urn:schemas:calendar:">
<a:sql>SELECT "DAV:id", "DAV:getlastmodified" FROM Scope('SHALLOW
TRAVERSAL OF
"DAV:href" =
</a:searchrequest>
but it is giving me "Bad Request" error where as appointment is present with
href
Although If I remove where condition in Select clause then it shows all the
appointment including href
Please suggest where I am doing wrong.
Thanks & regards,
Atul Saxena
Loading...