Automatically Turn on/off OOA based on day and time

Posted on 2009-04-23
Last Modified: 2012-05-06
We are running an Exchange 2007 environment on Windows 2003 Server and our workstations are running Outlook 2007 on Windows XP SP2. Both Exchange and Outlook are running the latest service packs. We have a call center environment in our company which answers emails during a specific period of time during the day from a single shared mailbox, from 8am to 6pm Monday through Friday. I know that you have the ability to configure your OOA to start at a specific date and time and also stop it at a specific date and time. I wanted to see if there was a way to automatically configure the Out of Office Assistance to turn itself on at the end of our shift and then automatically turn itself off at the beginning of the shift. Since it is a shared mailbox, what we have to do now to make that happen is log into that shared mailbox through Outlook and turn on the OOA at the end of our shift and then do the same when we have to turn off the OOA at the beginning of our shift. We would obviously prefer a free solution if there is one available. Our research so far has turned up some VB scripts but they have to run on the client side and for us since it's a shared mailbox, we just add it as an additional mailbox in our Outlook profile so we can see our personal mailbox along with the other shared one. THis solution would have to run on the server side or be something that we can enable without loging into this shared mailbox every time to configure the OOA.

Any suggestions would be greatly appreciated.
Question by:OWN3D
    LVL 76

    Expert Comment

    by:David Lee
    Hi, OWN3D.

    I'm not sure this will work and am not in a position to test it.  You can try it and see what happens.  The worst that'll happen is it won't work.

    1.  Open Notepad
    2.  Copy the code and paste it into Notepad
    3.  Edit the code per the comments I placed in it
    4.  Save the file with a .vbs extension

    Double-click the file to run it.  If it works, then we can talk about how to set it up to run automatically.

    This code uses Collaboration Data Objects (CDO).  If they aren't installed on the server, and I don't know if Exchange 2007 comes with them, then this will not work.  CDO does not come with Outlook 2007, but might be on your computer if you upgraded from an earlier version of Outlook.  The computer you run this from must have a mail profile defined for the shared mailbox.  That profile name has to be entered on line 4 of the code per the comment.

    Dim objMAPISession
    Set objMAPISession = CreateObject("MAPI.Session")
    'Replace Outlook with the name of your profile.  Replace Password with the password for that profile.'
    objMAPISession.Logon "Outlook", "Password", False, True
    objMAPISession.OutOfOffice = True
    Set objMAPISession = Nothing

    Open in new window


    Author Comment

    Thanks for the information BlueDevilFan. I ran the VB script on a WinXP workstation running Outlook 2007 with the shared mailbox profile setup and it failed with the error message "ActiveX component can't create object: 'Mapi.Session'. Code: 800A01AD. Source Microsoft VBScript runtime error. <<See attached: VBScript-Error-042409.png>. This was expected since it does not come with Outlook 2007 or XP natively. I then tried to install the CDO libraries following this MS article: and got an installation error saying  "Collaboration Data Objects 1.2.1 cannot be installed with Microsoft Exchange." <<See attached: CDOInstall-Error-042409.png>.
    Unfortunately I don't know where to date this possible solution from here. I also cannot make any changes in our exchange environment for this to work so any changes would have to be made on the client side.
    Any help is appreciated.

    LVL 76

    Expert Comment

    by:David Lee
    I'm a little confused.  You tried the script on a workstation running XP and it failed because CDO wasn't installed.  You then "tried to install the CDO libraries" and got the error "Collaboration Data Objects 1.2.1 cannot be installed with Microsoft Exchange".  How did you get from trying the script in a workstation to attempting to install CDO on the Exchange server?  How about installing CDO on the workstation?  

    Author Comment

    I understand how that error message is misleading because it says it "cannot be installed with MS Exchange". I didn't try installing anything on the server. I will not be making any changes on our Exchange servers unless it's adding a server side rule of some kind.  I tried installing the CDO libraries on the XP workstation running Outlook 2007 and received that error message.
    LVL 76

    Accepted Solution

    Got it.  Don't know what else to suggest.  The code depends on CDO 1.21.  I can do it client-side in Outlook 2007, but you'd indicated that you aren't looking for a client-side solution.  The only other means I know of is to use a 3rd-party solution which isn't free.

    Featured Post

    Free book by J.Peter Bruzzese, Microsoft MVP

    Are you using Office 365? Trying to set up email signatures but you’re struggling with transport rules and connectors? Let renowned Microsoft MVP J.Peter Bruzzese show you how in this exclusive e-book on Office 365 email signatures. Better yet, it’s free!

    Join & Write a Comment

    Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
    Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
    In this video we show how to create a Distribution Group in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >>…
    To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now