FW: Searching folders with WebDAV

Accidentally caugh by the spam filter.

- Jim

-----Original Message-----
From: Lisa Horton [mailto:lhorton@agtrax.com]
Sent: Monday, January 21, 2002 8:37 AM
To: w3c-dist-auth@w3.org
Subject: [Moderator Action] Searching folders with WebDAV


I hope someone can help me with 2 problems I am having with WebDAV.  I am
developing a web page that shows public folder data from our Exchange Server
such as calendar data and contact data.  We access our Exchange Server
through our web server using URLs.  I have had much success using WebDAV,
but have hit a "brick wall" on 2 items which are listed below with code.

1)  I am trying to perform a SEARCH on a public folder using SQL/XML/WebDAV
and I am receiving no response.

CODE:
 dim objXML, strR, strURL, docXML, sReq
    Set objXML = CreateObject("Microsoft.XMLHTTP")
    strURL = "http://mail.agtrax.com/public/AgTrax/web%20Calendar/"
    objXML.open "SEARCH", strURL, False, webExchgUserName, webExchgPassword

    sReq="<?xml version='1.0'?>"
    sReq= sReq & "<a:searchrequest xmlns:a = 'DAV:' >"
    sReq= sReq & "<a:sql>Select 'urn:schemas:calendar:dtstart', "
    sReq= sReq & "'urn:schemas:calendar:location', "
    sReq= sReq & "'urn:schemas:calendar:dtend', "
    sReq= sReq & "'urn:schemas:calendar:alldayevent'"
    sReq= sReq & " FROM Scope('SHALLOW TRAVERSAL OF '" & strURL & "'')"
    sReq= sReq & " WHERE NOT 'urn:schemas:calendar:instancetype' = 1"
    sReq= sReq & " AND 'DAV:contentclass' =
'urn:content-classes:appointment'"
    sReq= sReq & " AND 'urn:schemas:calendar:dtend' &gt;
'2002-02-01T01:00:00.000Z'"
    sReq= sReq & " AND 'urn:schemas:calendar:dtstart' &lt;
'2002-02-28T01:00:00.000Z'"
    sReq= sReq & " ORDER BY 'urn:schemas:calendar:dtstart' DESC"
    sReq= sReq & "</a:sql>"
    sReq= sReq & "</a:searchrequest>"
    objXML.setrequestheader "Translate", "f"
    objXML.setRequestHeader "Content-type:", "text/xml"
    objXML.setRequestHeader "Host:", "mail.agtrax.com"
    objXML.setRequestHeader "Depth", "1"

    objXML.Send (sReq)
    Set docXML = objXML.responseXML

    Dim objNodeAppt, i
    dim objNode
    Set objNodeAppt = docXML.getElementsByTagName("*")
    For i = 0 TO (objNodeAppt.length -1)
      Set objNode = objNodeAppt.nextNode
        Response.Write("<b>" & objNode.NamespaceURI & " " & objNode.NodeName
& "</b> - ")
      Response.Write(objNode.text  & "<hr>")
    Next

2) I am trying to create a contact folder (in Exchange)using MKCOL and I am
receiving the Status Code 403 (Forbidden).  Is this just an issue with
permissions or am I using the wrong method to create a folder?  The code is
below:

CODE:
 dim objXML, strR, docXML
    Set objXML = CreateObject("Microsoft.XMLHTTP")
    strURL = "http://mail.agtrax.com/public/Agtrax/Test Folder"
    objXML.open "MKCOL", strURL, False, webExchgUserName, webExchgPassword
    strR = "<?xml version='1.0'?>"
    strR = strR & "<d:propertyupdate xmlns:d='DAV:'>"
    strR = strR & "<d:set><d:prop>"
    strR = strR & "<d:displayname>Test Folder</d:displayname>"
    strR = strR & "</d:prop></d:set>"
    strR = strR & "</d:propertyupdate>"

    objXML.setRequestHeader "Content-type:", "text/xml"
    objXML.setRequestHeader "Host:", "mail.agtrax.com"
    objXML.Send (strR)
     Set docXML = objXML.responseXML

    Dim objNodeAppt, i
    dim objNode
    Set objNodeAppt = docXML.getElementsByTagName("*")
    For i = 0 TO (objNodeAppt.length -1)
      Set objNode = objNodeAppt.nextNode
        Response.Write("<b>" & objNode.NamespaceURI & " " & objNode.NodeName
& "</b> - ")
      Response.Write(objNode.text  & "<hr>")
    Next

Thanks for your help,
Lisa Horton
AgTrax Technologies
lhorton@agtrax.com

Received on Monday, 21 January 2002 14:59:32 UTC