In the code window, replace the code with the following:
Module Module1
Sub Main()
Dim oXMLHttp As MSXML2.XMLHTTP30 = New MSXML2.XMLHTTP30()
Dim sUrl As String
Dim sQuery As String
' TODO: Replace with your folder URL
sUrl = "http://ExchSrvr/public/MyFolder/MySubFolder"
' TODO: Replace the domain name, the user name, and the password with your actual
' domain name, user name, and password.
oXMLHttp.open("SEARCH", sUrl, False, "domain\username", "password")
' Find items with Subject = 'Test'
sQuery = "<?xml version='1.0'?>" & _
"<g:searchrequest xmlns:g='DAV:'>" & _
"<g:sql>SELECT ""DAV:displayname"" " & _
"FROM SCOPE('SHALLOW TRAVERSAL OF """ & sUrl & """') " & _
"WHERE ""urn:schemas:mailheader:subject"" = 'Test'" & _
"</g:sql>" & _
"</g:searchrequest>"
' Set the request headers.
oXMLHttp.setRequestHeader("Content-Type", "text/xml")
oXMLHttp.setRequestHeader("Translate", "f")
oXMLHttp.setRequestHeader("Depth", "0")
oXMLHttp.setRequestHeader("Content-Length", "" & sQuery.Length)
' Send the request.
oXMLHttp.send(sQuery)
' Output the response.
Console.WriteLine(oXMLHttp.status)
Console.WriteLine(oXMLHttp.statusText)
Console.WriteLine(oXMLHttp.responseText)
' Clean up
oXMLHttp = Nothing
End Sub
End Module
|