Wednesday, June 09, 2004

Setting OOF status and Text using a OWA Script

I created this blog entry a couple of days ago about using the Microsoft.XMLHTTP to do some automation scripting with exchange in regards to adding entries into the junk email whit lists. This same method can also be used to set a variety of other settings as well, one of these is a user OOF ( Out of office ) setting. You can also set this via a script using CDO 1.2 and also via Exoledb/WebDAV but this does offer a simple alternative. To set the OOF setting of a user you just issue the following commands

OofReply=Im Out of the Office

An example of using this in a script would be

szXml = ""
szXml = szXml & "Cmd=options" & vbLf
szXml = szXml & "OofReply=Im Out of the Office" & vbLf
szXml = szXml & "OofState=1" & vbLf

Set oXmlHttp = CreateObject("Microsoft.XMLHTTP")
oXmlHttp.Open "POST", "http://youserver/exchange/youruser/", False, "", ""
oXmlHttp.setRequestHeader "Accept-Language:", "en-us"
oXmlHttp.setRequestHeader "Content-type:", "application/x-www-UTF8-encoded"
oXmlHttp.setRequestHeader "Content-Length:", Len(szXml)
oXmlHttp.Send szXml

Wscript.echo oXmlHttp.responseText