Look up e-mail recipients from Outlook address book
Posted on 2003-11-19
Here is what I need to be able to do.
We use Outlook 98 across the board around here. If a user is composing an e-mail message and the recipient is something like 'Joe Blow', they can usually just write "Blow, J" or something like that and Outlook will resolve the rest. It looks up the contact in the global address book and if there is only one match, it replaces "Blow, J" with that contact. If there is more than one match it prompts the user to pick one.
In my app users can click a button to create a new e-mail message, with the body populated with info from the current record. I have built in something that will also populate the 'To' field with a list of contacts. This list is maintained by the users on a diferent form. Each contact is just a name in plain text and optionally an e-mail address, but in most cases this is not required since it is always an internal contact. What I do is create a new MAPI.Recipient, assign the e-mail address if applicable, assign its name accordingly, and then call MAPI.Recipient.Resolve to have it resolve to a contact on the outlook message.
What I would like to do is have the resolution happen on the other form where the list is maintained. i.e., a user enters all or part of a contact name into my text box, clicks OK, and then it would resolve to the correct contact. I would need to store the full name and e-mail address. There would be no change to the way my e-mails are sent, it would still just have to take the plain text name and e-mail and assign it to a MAPI.Recipient. The difference is that the user is able to check if the contact is valid or not when they first save that text.
In other words, I have a (full or partial) name, and I want a proper contact name and e-mail address from the global address book.
I hope this makes sense. How can it be accomplished?