View Single Post
  #2  
Old July 28th 06, 07:29 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to use "Look up Outlook Contact" function with code? VSTO 2005

One way or the other you're going to be comparing email addresses. How
quickly that goes depends on how you do that.

If using the Outlook object model probably the quickest way is to use a
Restriction on the Items collection of each contacts folder, restricting
first on Email1Address then on Email2Address then on Email3Address.

Once you have that contact item getting its EntryID and an object reference
to the contact and then displaying it is easy.

A much quicker way would be to use a lower level API such as Extended MAPI
(which is what Outlook does but it can only be programmed using C++ or
Delphi) or something like Redemption (an Extended MAPI wrapper) and using a
filtered MAPITable. That would be anywhere from 10 to 100 times faster than
using the Outlook object model.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"David Webb" wrote in message
...
In Outlook 2003, if you open a message and hover over the name in the From
field, a menu appears with "Look up Outlook Contact" as one of the menu
items
which will either open up a Contact or display a message stating that no
matching contact was found.

I would like to be able to use code in my VSTO 2005 Add-In to open a
message
and check to see if there is a matching Contact. If so, I want to set some
of
the UserProperties of the Contact Item.

Currently, I am searching for a string in the Subject of the Inbox items
and
when one is found, I then loop through all of the Contacts to find a
matching
email address. This seems to me to be the slow way of doing it although it
does work.

It would probably be much faster to be able to open up a Contact item
using
code the same way that a user can open up a Contact item by using the
"Look
up Outlook Contact" function.

Is this possible or is looping through the Contacts collection and
comparing
email addresses the only way?
--
David Webb


Ads