Export (0) Print
Expand All

Constructing WebDAV Requests with XMLDOM

EWS Managed API

Topic Last Modified: 2006-06-12

This example shows how you can construct the body of a WebDAV PROPFIND Method by using the Microsoft XML (MSXML) COM component. In the XML DOM object model, you use the AppendChild method to create nodes and add them to the XML document. After the request has been constructed as an XML DOM document, you then pass a reference to an XMLHTTP Component Object Model (COM) object and send the PROPFIND Method request to the server.

See Constructing Exchange Store HTTP URLs and Authentication and Security Using WebDAV for more information.

VBScript


<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>PROPFIND</TITLE>
</HEAD>
<BODY>

<SCRIPT FOR=window EVENT=onload LANGUAGE=VBScript>
<!--

Set req = CreateObject("Microsoft.XMLHTTP")
Set domin = CreateObject("Microsoft.XMLDOM")
Set domback = CreateObject("Microsoft.XMLDOM")

req.Open "PROPFIND", "http://example.com/public/docs/myFile.doc", False, "Domain\User", "thepassword"

req.setRequestHeader "Content-Type", "text/xml; charset=""UTF-8"""

Set oPi = domin.createProcessingInstruction("xml", "version='1.0'")
domin.appendChild(opi)

Set PFind = Domin.CreateNode(1, "d:propfind", "DAV:")
domin.AppendChild PFind

Set DProp = Domin.CreateNode(1, "d:prop", "DAV:")
PFind.AppendChild DProp

Set Author = Domin.CreateNode(1, "O:Author", "urn:schemas-microsoft-com:office:office")
DProp.AppendChild Author
MsgBox domin.XML, ,"IN: PROPFIND"

req.Send Domin

MsgBox req.StatusText, ,"PROPFIND"
Set domback = req.ResponseXML
MsgBox domback.XML, ,"OUT: PROPFIND"
MsgBox domback.Text, ,"OUT: PROPFIND (text)"

Set req = Nothing
Set domin = Nothing
Set domback = Nothing

' -->
</SCRIPT>



</BODY>
</HTML>



Show:
© 2014 Microsoft