?
Solved

Automate Out Of Office Assistant

Posted on 2002-04-18
19
Medium Priority
?
282 Views
Last Modified: 2010-04-08
Hi all!

I want to turn the Out Of Office assistant on and off throught code, based on the Calender. All CLIENT side.

I built the code for trapping the Appointment_Reminder event, but can't find the method to actually turn the OOA on/off.

D'Mzzl!
RoverM
0
Comment
Question by:roverm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 9
19 Comments
 
LVL 16

Expert Comment

by:Neo_mvps
ID: 6950552
The OOA is not exposed in the Outlook Object Model, but is exposed through Collaboration Data Objects.  See http://www.cdolive.com/outofofficecalendar.htm for a code sample.
0
 
LVL 12

Author Comment

by:roverm
ID: 6950795
I had that sample already, but can't seem to integrate that into my VBA application.
Any suggestions ?

D'Mzzl!
RoverM
0
 
LVL 16

Accepted Solution

by:
Neo_mvps earned 600 total points
ID: 6951069
Should be as simple as...

Set oSession = CreateObject("MAPI.Session")
oSession.Logon "","",false, false

oSession.OutOfOffice = True
oSession.OutOfOfficeText = "Whatever you want the body to say."

oSession.Logoff

Set oSession = Nothing


Note: Collaboration Data Objects is not installed by default under Outlook 2000 or 2002.  It is installed by default under Outlook 98 and doesn't come with Outlook 97.
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 12

Author Comment

by:roverm
ID: 6952672
Unfortunally not......

On the line Set oSession I get an error:
"Internal Application Error". CDO is installed.

Also, in VBA I tried this:

Set oMAPI = Outlook.GetNameSpace("MAPI")
Set oSession = oMAPI.Session

to get the session object.
But then the OutOfOffice property is not supported (Object doesn't support...)

D'Mzzl!
RoverM
0
 
LVL 16

Expert Comment

by:Neo_mvps
ID: 6953687
Why are you trying to shove the Outlook namespace into a cdo session object?  Also, do you get the same error using my code snippet?
0
 
LVL 12

Author Comment

by:roverm
ID: 6954302
Because I tried to get the Outlook instance session. Didn't work obviously... ;-)

Yes, I get exactly the same error using your code.
0
 
LVL 16

Expert Comment

by:Neo_mvps
ID: 6954754
odd... check to see if you have CDO.DLL on your system.  If so, do a regsvr32 on it to see if you just need the registry refreshed.
0
 
LVL 12

Author Comment

by:roverm
ID: 6954772
Yes, it's installed....
The exact error using your code is:
[E-NOINTERFACE(80004002)]

0
 
LVL 16

Expert Comment

by:Neo_mvps
ID: 6954797
Woa... what version of Outlook are you working with?
0
 
LVL 12

Author Comment

by:roverm
ID: 6954890
Outlook 2000, SR-1 on a Windows 2000 Professional machine.
0
 
LVL 16

Expert Comment

by:Neo_mvps
ID: 6955373
weird... Outlook 2000 is configured in Corporate/Workgroup and you are connected to a microsoft exchange server at the time of running this code?
0
 
LVL 12

Author Comment

by:roverm
ID: 6955741
Yes, I ran it while connected.
0
 
LVL 16

Expert Comment

by:Neo_mvps
ID: 6955859
Hmmm...  Here are some of the things I would try.

1) Uninstall/Reinstall Collaboration Data Objects
2) Change the logon method to:

oSession.Logon "Profile Name", "Password", False, False
0
 
LVL 12

Author Comment

by:roverm
ID: 6956613
Hi Neo_mvps!

Very sorry, but your solution worked after all!
I dunno why the first time not, but just tried it again and it worked perfectly!

The only difference now is that I tried from home using a dial up connection to work. The first time I was in the office. Will check it there again also on Monday.

Thanks for your help!

One other question (if you know I will open a new question about this):
I can't seem to find the event when an appointment is finished. What I have done now is programmaticly add a new appointment at the end of the *real* appointment and trap the reminder event.
Is there a better way to do this ? Can you trap the "Appointment_End"-event ?

D'Mzzl!
RoverM

btw:Increased points to 150
0
 
LVL 16

Expert Comment

by:Neo_mvps
ID: 6957615
hmm... since there isn't an appointment end event, the best I can think of is the following.

1) you catch the application_reminder event.
2) this event gives you a reference to the object that is firing it.
3) if the object is an appointmentitem, then review whichever properties you need (e.g. see if you are working with a reccuring item, etc.) and then go from there.
0
 
LVL 12

Author Comment

by:roverm
ID: 6957630
This is what I am doing now.
Unfortunally there's no timer orso available. Yes, I could do that via API (SetTimer) but don't want to do that.
I guess I will stick with creating another appointment at the end of the real one.

I just wanted to know another thing:
I want to use some variables orso that will retain even when Outlook is shut down. So, the next time Outlook starts read those values again, like custom properties. Don't want to use GetSetting/SaveSetting to the registry. Any ideas on that (will open another question....... ;-) )

D'Mzzl!
RoverM
0
 
LVL 12

Author Comment

by:roverm
ID: 6959077
k, found out what the problem was at work:

The CDO.DLL was installed, but not registered ok and couldn't be registered manually! (couldn't load library)

But by setting a reference to this library in VBA in Outlook, then remove the reference the library was loaded correct!

At home it worked because I used my laptop and at work my desktop machine....

D'Mzzl!
RoverM
0
 
LVL 16

Expert Comment

by:Neo_mvps
ID: 6964016
The vba environment in outlook wasn't designed to have values persist in memory between different macro runs, so the only thing you could do is save the items into the registry via the win32api* or use get/savesetting.


/Neo

* Many VB sites have great examples on how to use the win32 api to read/write values from the registry.  one that sticks out in my head is vbaccelerator.
0
 
LVL 12

Author Comment

by:roverm
ID: 6966551
Thanks Neo!
I do know how to read and write from/to the registry, but I prefer not to use that.

Will let you know what my solution will be.

Thanks!

D'Mzzl!
RoverM
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
Suggested Courses

777 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