View Single Post
  #3  
Old June 14th 07, 10:33 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Contact Program

Right, if you use those rule condition/exceptions, you won't have to do Step #2 at all.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"BrianL" wrote in message ...
I did not realize it, but I have this question twice in the newsgroup haha.
Sue M. gave me the idea to make the first steps more simple: just have a
rule that applies to every message, and make an exception for emails sent by
a contact. If it isn't in the contact list, then I will run the msgbox /
script to actually add the contact.

We havn't completely finished discusing it, but the code you provided will
give me good ground to build on. I really appreciate your input here =].

"Eric Legault [MVP - Outlook]" wrote:

1. retrieve addresses from emails

From an individual e-mail, use Item.SenderEmailAddress.
To retrieve from all e-mails, loop through the MAPIFolder.Items collection
for the folder you want to inspect

2. Check for the address in the contacts list

Use a loop through the Items collection from the Contacts folder. Use
Items.Restrict("[Email1Address = '") to filter the collection.
Repeat with Email2Address and Email3Address. OR - use Redemption
(www.dimastr.com) - which has a handy RDOAddressEntry.GetContact method.

3. run a form that will prompt "would you like to add as contact"

You don't need to design a form for this, unless you really need to
customize the dialog. Use the MsgBox method.

4. when you click yes, opens the standard "add contact" form with the email
already filled out (this one is optional)

Use something like:
Set objContact = olApp.CreateItem(olContactItem)
objContact.Email1Address = strEmail
objContact.Display

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/



Ads