OOF (Out Of Office) Automation is a VBScript-based automation of switching the OOF Assistant on automatically when the respective user has entered an "away" appointment and back to off when there is no "away" appointment anymore.
This works by utilizing CDO externally using the Task Scheduler, e.g. all 30 minutes. There is also an internal solution to be found at CDOLive. However, I had a MAPI problem when implementing it, as my Outlook OOF Message was suddenly out of sync with the message modified within the script.
Using the Script
Every end user wishing to participate in the automated OOF Assistant switching has to set at least one (configurable) placeholder in his OOF Message in place of a date to be displayed in his final Message (e.g. "I'm out of the office
<Date>. For urgent matters, please contact my... - Kind regards, Roland").
<Date> would then be replaced by
from <begin date/time> to <end date/time>.
to can be configured in the script for two languages (currently German and English). The respective placeholders are
Once that is done, all the end user has to do is enter his absences as "away" appointments or whole day events. The OOFAutomation script will switch the OOF Assistant for him completely automatically. Administration is supported with the extensive logging into a specified file (see Installation below).
Installation is done by copying the two scripts into a folder reachable by the OOFAutomation server. This could be any Desktop PC or server that has either Outlook or Exchange Server installed. I haven't checked whether installation of a separately available CDO library would also be sufficient, but judging from Microsoft's statements on the download page, it ought to be.
After copying the script to the target folder, create a scheduled task on the OOFAutomation server that starts the script, e.g. every 30 minutes. The account that the task is run under needs to have administrative rights in Exchange or at least access rights to all end users' MAPI stores. Before activating the task, however, you have to configure the two scripts:
Const sServerName = "OEBFASRV02"
Dim sProfileInfo sProfileInfo = sServerName & vbLf & "Administrator"
Const placeHolderLang1 = "<Datum>"
Const placeHolderLang2 = "<Date>"
Const infixFrom1 = "von "
Const infixFrom2 = "from "
Const infixTo1 = " bis "
Const infixTo2 = " to "
Const infixOn1 = "am "
Const infixOn2 = "on "
Const ErrMailDistributionList = "rkapl"
Log.vbs is a separately usable, simple
Logger class. It can be used in other scripts as follows:
Set WshShell = WScript.CreateObject("WScript.Shell")
Set theLogger = new_Logger(Array(PathToLogFolder,NameOfLogFile,_
theLogger.LogInfo "Info Message"
theLogger.LogWarn "Warning Message"
theLogger.LogError "Error Message"
theLogger.LogStream (WshShell.Exec object)
theLogger.LogFatal "Fatal Message (stops the script)"
However, it also needs to be configured before use:
Const defaultMailRecipients = "rkapl,mkovacs,gnebenfuehr,mhoessl,gschrenk"
Const defaultMailSender = "Administrator@oebfa.co.at"
Const defaultMailSubject = "Process Error"
Const internalLogFile = _
Const defaultLogPath = "\\oebfasrv01\marktdaten\Logs"
Finally, activate the task and test by entering the configured placeholder(s) in your OOFMessage text. Enter an "away" appointment that starts before now -1 minute and ends after now +1 minute.
Points of Interest
Of course, lots of the concepts used were taken from CDOLive.
- 03/07/2007: Version 1.0: CodeProject article posted
- 03/10/2007: Version 1.1: Bugfix for updating the OOF Message from Outlook. This is now possible as long as "I'm currently in the office" is selected and there is at least one of the placeholders (e.g.
<Datum>) contained in the message.