Howto: WebDAV SEARCH using VBScript

'The example below demonstrates how to do a WebDAV SEARCH 

dim strExchangeURL
dim strApptStartDate
dim strUser
dim strPassword
strUser  = "Administrator"
strPassword = "test"
strExchangeURL = "https://myexserver/exchange/Administrator/Calendar/"
strApptStartDate = "2004-04-09T15:00:00Z"
Dim sRet

strQuery = "<?xml version='1.0'?>" & _
"<g:searchrequest xmlns:g='DAV:' >" & _
"<g:sql>SELECT  " & vbCrLf & _
        """urn:schemas:calendar:alldayevent"", " & vbCrLf & _
        """urn:schemas:calendar:duration"", " & vbCrLf & _
        """urn:schemas:calendar:dtstart"", " & vbCrLf & _
        """urn:schemas:calendar:dtend"", " & vbCrLf & _
        """urn:schemas:httpmail:displayto"", " & vbCrLf & _
        """urn:schemas:httpmail:displaycc"", " & vbCrLf & _
        """urn:schemas:httpmail:textdescription"", " & vbCrLf & _
        """urn:schemas:calendar:location"", " & vbCrLf & _
        """urn:schemas:httpmail:subject"" " & vbCrLf & _
    "FROM SCOPE('SHALLOW TRAVERSAL OF """ & strExchangeURL & """') " & vbCrLf & _
    "WHERE (""urn:schemas:calendar:dtstart"" >= CAST(""" & strApptStartDate & """ as 'dateTime')) " 
& vbCrLf & _
     "</g:sql>" & vbCrLf & _
     "</g:searchrequest>" & vbCrLf

Wscript.Echo "about to call ServerDav" 
sRet = DoServerDavRequest("SEARCH", strQuery, strExchangeURL, strUser, strPassword)
Wscript.Echo sRet
 
 
Function DoServerDavRequest(sType, sQuery, sHREF, sUserName, sPassword)
    ' Create the SQL query textnode and append it to document.
    Set docRequest = Createobject("MSXML2.DomDocument")
    Set xndQuery = docRequest.createTextNode(strQuery)
       
    ' Create the XMLHTTP object.

    Set davRequest = CreateObject("MSXML2.SERVERXMLHTTP")
    davRequest.open sType, sHREF, False, "Administrator", "test"

    davRequest.setRequestHeader "Content-Type", "text/xml"
    davRequest.setRequestHeader "Translate", "f"
                   
    ' Send the SEARCH request.
    if sQuery = "" then
        davRequest.send
    else
        davRequest.send (sQuery)
    end if
 
   DoServerDavRequest = davRequest.responsetext
End Function