Board index » delphi » Catching Events from MS Outlook

Catching Events from MS Outlook


2003-08-29 04:05:58 AM
delphi76
Hi!
I need to do some (database) operations in my application whenever the
user opens or saves a contact. I think the easiest way would be to write
some VBA code that calls my app, but I did not find an
"OnSaveContactItem" event or something like that. Is there another
possibility? I imported the typelibrary of Outlook, but I can not find any
place to install a callback or so on.
I'm using D7, Outlook 2000.
Thank you for any help!
Joe
 
 

Re:Catching Events from MS Outlook

There is no easy way to do that - you can set event sinks on the selected
items (use Explorer.Selection collection), then trap
ContactItem.PropertyChange event. This event won't always fire.
A better solution would be to use Extended MAPI to set an advise sink on the
Contacts folder (IMsgStore.Advise passing the entry id of the Contacts
folder), but then you will get tons of notifications.
You will also miss notifications when your app is not running.
If I were you, I would simply use a timer and check if there are any modified
items since the last sync; if yes, go through the modified items and sync
them.
Dmitry Streblechenko (MVP)
www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Joe" <XXXX@XXXXX.COM>writes
Quote
Hi!

I need to do some (database) operations in my application whenever the
user opens or saves a contact. I think the easiest way would be to write
some VBA code that calls my app, but I did not find an
"OnSaveContactItem" event or something like that. Is there another
possibility? I imported the typelibrary of Outlook, but I can not find any
place to install a callback or so on.

I'm using D7, Outlook 2000.
Thank you for any help!

Joe