Howto: WebDAV PROPPATCH using VBScript
'The example below demonstrates how to do a WebDAV PROPPATCH.
'The sample changes the subject of one message in the inbox.
' Note: You cannot specify a condition with a PROPPATCH;
' Note: Understand how the Depth header affects patching and you should understand how its used
before using any other setting than 0.
dim sHREF
dim sUserName
dim sPassword
dim sResponse
Dim HttpWebRequest
dim sReq ' Body Proppatch statement
sHREF = "https://myexserver/exchange/Administrator/Inbox/testabcd.EML" ' TODO: change
sUserName = "Administrator" ' TODO: change
sPassword = "test" ' TODO: change
set HttpWebRequest = CreateObject("microsoft.xmlhttp")
'Set HttpWebRequest = New Msxml2.XMLHTTP30
HttpWebRequest.Open "PROPPATCH", sHREF, False, sUserName, sPassword
HttpWebRequest.setRequestHeader "Content-Type", "text/xml"
HttpWebRequest.setRequestHeader "Depth:","0"
sReq = "<?xml version='1.0'?>"
sReq = sReq & "<d:propertyupdate xmlns:d='DAV:' xmlns:m='urn:schemas:mailheader:'>"
sReq = sReq & "<d:set><d:prop>"
sReq = sReq & "<m:subject>" & "test1" & "</m:subject>"
sReq = sReq & "</d:prop></d:set></d:propertyupdate>"
wscript.echo sReq
HttpWebRequest.Send sReq
sResponse = HttpWebRequest.ResponseText ' Returns as text
'ReadAnAttatchment = HttpWebRequest.responseBody ' Returns as encoded
Set HttpWebRequest = Nothing