help with AddRecipToContacts procedure by Sue Mosher

G

Guest

I am a newbie to Outlook VBA, so pardon me if this is a stupid question.

I am using the code by Sue Mosher that's found here
(http://www.outlookcode.com/d/code/autoaddrecip.htm) to automatically add
recipients of my outgoing mail to my contacts folder. This is working and I
am very excited about it. Many thanks to Sue for making this code available.

However, I am in an Exchange environment and when I send mail to another
Exchange user, I end up with a contact that has an email address like this:
"/o=Exchange1/ou=First Administrative Group/cn=Recipients/cn=jondoe"

Is there a way to modify the AddRecipToContacts procedure so that it only
adds those recipients who are not exchange users? Better yet, is there a way
to get the Exchange user's actual email address?

Thanks in advance,
Richard
 
G

Guest

One last thing. I am also using a rule on my machine to add my own email
address in the CC field to each message that I send. When I put Sue's code
into place on my machine, this rule has stopped functioning.

Is there a way to make the rule work again? Or better yet, have this code
insert my email address as a BCC instead so I can delete the rule?

Thanks again!
-- Richard
 
S

Sue Mosher [MVP-Outlook]

I'm glad you like the code. You can check the value of Recipient.AddressEntry.Type to determine whether the recipient has an SMTP address.

The sample code at http://www.outlookcode.com/d/code/autobcc.htm shows how to add a Bcc recipient using the same Application.ItemSend event in Outlook VBA. You'd just need to combine the two into one procedure.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Hi Sue,

Thanks again for the code, and for the link to the BCC code. I have played
around with it and I now have my contacts being added only when they are
SMTP. I even included a message box when a new contact is identified to ask
me if I want to add them. That might get annoying after a while, but I like
it for now.

One note, while looping through the repicipients on each outgoing email, I
had to remove the AddQuote function from around the objRecip.Address. The
quotes were being stored with the email address in my contact item, and when
I typed the email into the To: box it did not have quotes, so they were not
seen as matching. In this scenario, it would add the email address to my
contacts each time I included it on a mail. It's working perfectly now.

One last question. For those users who are exchange users, is there no way
to get the resolvable email address for those users through VBA? I tried
searching for this on google, but I could not qualify a search well enough to
get exactly what I was looking for.

Thank you so much,
Richard
 
S

Sue Mosher [MVP-Outlook]

The quotation marks are needed only to build the search string to locate an existing contact.

For Exchange users, the address you have *is* resolvable. It's just an EX address, not an SMTP address. If you want the SMTP address, you need Outlook 2007, Redemption, and, if you have a high tolerance of security prompts, CDO 1.21.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/article.aspx?id=54
 
G

Guest

Ok, thank you Sue. I know that the exchange address is resolvable as long as
I'm using exchange. One of the reasons for me wanting to add all recipients
to my contact list is so I will have a ready made electronic rolodex if I
ever decide to leave the company. To mail these folks from the outside, I
would need an SMTP address for these exchange folks. Oh well, I guess I will
just have to live with the SMTP recipients and be thankful for that at least.

I appreciate your help.

-- Richard
 

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