Howto: WebDAV GET using VBScript
'The example below demonstrates how to do a WebDAV GET.
' GET works against items and attachments. When used against an item, it give you
' the mime stream of both the message and attachment. You cannot get the mime of only the message
' if there are attatchments on that message. Use X-MS-ENUMATTS to enumerate attachents - this returns
' back a phantom URL for each attachment which can be used by GET.
' NOTE: You need to have a header of "Translate" set to "f" in order to read mime of an item with a GET.
dim sHREF
dim sUserName
dim sPassword
dim sResponse
Dim HttpWebRequest
sHREF = "https://myexserver/exchange/Administrator/Inbox/testabcd.EML" ' TODO: change
sUserName = "Administrator" ' TODO: change
sPassword = "test" ' TODO: change
set HttpWebRequest = CreateObject("microsoft.xmlhttp")
HttpWebRequest.Open "GET", sHREF, False, sUserName, sPassword
HttpWebRequest.setRequestHeader "Content-type:", "text/xml"
HttpWebRequest.setRequestHeader "Translate:", "f"
HttpWebRequest.Send
sResponse = HttpWebRequest.ResponseText ' Returns as text
Set HttpWebRequest = Nothing
wscript.echo sResponse
Comments
- Anonymous
August 19, 2012
Can you do a VB script WebDav GET for files?