Platform SDK: Exchange 2000 Server

PROPPATCH using an XMLDOM Object

[This is preliminary documentation and subject to change.]

This example sets an Author property in a document. A script in an HTML page creates the XMLDOM and XMLHTTP objects to submit the request.

Using the XMLDOM object model, nodes are created by using the AppendChild method. If a node needs to be nested within another node, you must append the new node to the correct parent.

Note that the XMLDOM object, to be passed to the XMLHTTP object, contains a CreateProcessingInstruction node to contain the XML Version information. This should be the first child node for HTTP requests.

The XMLHTTP object’s Send method sends the XMLDOM object containing the well formed nodes in an XMLDOM object.

To check status, a message box displays the XMLHTTP StatusText, followed by the XML of the XMLDOM object returned from the XMLHTTP object.

[VBScript]
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>PROPPATCH</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 "PROPPATCH", "http://myServer/public/docs/myfile.doc", False, "TheDomain\Administrator", "thepassword"

req.SetRequestHeader "encoding", "utf-8"


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

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

Set PUpdate = Domin.CreateNode(1, "d:propertyupdate", "DAV:")
domin.AppendChild PUpdate

Set DSet = Domin.CreateNode(1, "d:set", "DAV:")
PUpdate.AppendChild DSet

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

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

Set AuthorName = Domin.CreateTextNode("Ray Zambroski")
Author.AppendChild AuthorName

MsgBox domin.XML, ,"IN: PROPPATCH"

req.Send Domin

MsgBox req.StatusText, ,"PROPPATCH"

Set domback = Req.ResponseXML
MsgBox domback.XML, ,"OUT: PROPPATCH"
//-->
</SCRIPT>



</BODY>
</HTML>