Trigger Outlook Contact

  • Thread starter Thread starter Sheng Zhang
  • Start date Start date
S

Sheng Zhang

hello,

I don't know if this is the right place for my problem. I am actually
writing a TAPI driver
which enables dial a number directly from outlook->contact. It is all
working. But I still
want to trigger an Outlook event which opens a certain contact id, when the
phone allocated
to this id is called. Is there any API I can use in C++? or other
possiblities, whatever. thanks
in advance.


regards, Sheng
 
What do you mean by "opens a certain contact id"?

Do you mean you want to actually open the contact that has the number being
called? If so you just get the ContactItem object, which you have to have to
make the call and call its Display() method. That will fire the Outlook
Inspectors.NewInspector() event as well as the ContactItem.Open() event.
 
Add yourself a reference to a Microsoft Outlook Object Library and do as Ken
suggests. Here is some sample code in VBA

Dim fld As MAPIFolder
Dim ct As ContactItem
Set fld = Outlook.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts)
Set ct = fld.Items.Find("[CustomerId]=1234")
If Not ct Is Nothing Then
ct.Display
Set ct = Nothing
End If
Set fld = Nothing
 
Ken Slovak - said:
What do you mean by "opens a certain contact id"?

Do you mean you want to actually open the contact that has the number
being called? If so you just get the ContactItem object, which you have to
have to make the call and call its Display() method. That will fire the
Outlook Inspectors.NewInspector() event as well as the ContactItem.Open()
event.

--


thank you Ken for your quick response!

yes, exactly, I want to open the contact being called. My driver is a DLL
attached to TAPI.DLL
which is loaded within Outlook. My program isn't an AddOn for Outlook, but a
DLL driven from
TAPISRV service. (A Telefony Service) So I want to know if I can somehow
get the Outlook
objects from within my DLL and fire the Outlook events. Is that possible?
 
Sure. You would need to use either the Outlook object model or Extended MAPI
(C++ or Delphi only). You can use the phone number you get if that's all you
have to iterate the Items collection of the Outlook Contacts folder looking
for a matching phone number and then once you have the correct ContactItem
you can call Display() on it to open it and fire the Outlook events I
mentioned.

You can't fire the Outlook events directly, only as a result of an action
you take.

There are 17 different phone fields for each Outlook contact item, so you
might have to check against each one for each Contact, and you might have to
do a recursive search for all Contacts folders if the contact call wasn't
from a contact in the default Contacts folder, but it's definitely doable.
 
Back
Top