Selecting a contact from the address book.

L

Lucy

Hi,

I would like to find a way to select a contact and add their address to a
textbox. I want my controls to be similar to the To button and its textbox.
When my button is clicked the GAL dialog should open and when a contact is
selected their address should appear in the textbox. I do not want the
message then to be sent to this contact. How can I do this? (I am coding in
C# for Outlook 2003)

Thanks.
 
K

Ken Slovak - [MVP - Outlook]

Using the Outlook 2003 object model there's no way to show the address book
dialog. You can with the Outlook 2007 object model.

Since CDO 1.21 and Extended MAPI (C++ or Delphi only) aren't supported for
use with managed code, you really have 2 options given your constraints. You
can use the 3rd party Redemption library (www.dimastr.com/redemption) and
its RDOSession.AddressBook.ShowAddressBook() method to display the GAL and
return a selection from it, or you can iterate the GAL as an
Outlook.AddressList and get each AddressEntry from its AddressEntries
collection and display them in your own custom address book dialog.
 
L

Lucy

Thanks for your helpful reply. Is there anyway I could use the current 'To'
button (Or similar button) and just not send it to the selected address?
 
K

Ken Slovak - [MVP - Outlook]

You could use the To button and then read the Recipients collection but
unfortunately there are no events to handle when the To button is pressed or
when recipients are added to an item. So you'd never know when those things
occurred.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top