Adding Contact to Recipient Control

P

Paul Mac

Hi All,

I have a Outlook Form (Contact) with many custom fields on it, and I'm now
trying to add Contacts to the "Contacts" field programatically.

By default, the Contact Field has the event to open the MAPI Contact Folder
for you to select the recipient. The problem is that the Contacts I need to
source are in the GAL.

I have added some code to a replacement Command Button, which accesses the
GAL via CDO (From Sues Site.
http://www.outlookcode.com/d/code/selectnames.htm) modifying the multiple
recipient collection, to fire on the cmdAddContacts_Click event.

The issue that I'm now facing is how to update the "Contacts" field.

I've tried the following:
1................................................
Set colRecips = Item.Contacts
For Each objCDORecip In colCDORecips
Set objRecip = colRecips.Add( _
objCDORecip.AddressEntry.Address)
Next

2.................................................
Set Item.Contacts = colCDORecips

3................................................
Item.Contacts.Add objCDORecip.Item(1)

I'm sure that the simplest of solutions will be the answer, but I'm not sure
of how to add items to the Contacts collection.

Any help would be appreciated.

Thanks in Adavance,

Paul Mac
 
S

Sue Mosher [MVP-Outlook]

There is no ContactItem.Contacts field. Instead you need to be working with
the Links collection, whose Add method takes a ContactItem as its argument.
You can create links only with Outlook contacts, not with GAL entries.
 

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