Communicating w/Exchange Server '03

S

Shaun M. Angley

I'm doing some customization to some word templates and I have a problem I
just can't seem to figure out.
I've written some VBA code to do the following: When the user right clicks
in word, they get some options for custom forms that will import addresses,
emails, etc. into the doc from their contact list and or their global address
list.
I'm using MAPI Tags to get most of the info and it works perfect for any
record in the Outlook Contacts. But I can't get it to work the way I need it
to for the Global Address List.

The first batch of code looks like this:
strEmail = Application.GetAddress(strPickName, "<PR_EMAIL_ADDRESS>", , 2)
strEmailType = Application.GetAddress(strPickName, "<PR_ADDRTYPE>", , 2)
' Build in-house email address
If strEmailType = "EX" Then
strEmail = Mid(strEmail, 50, 100) & "@nospam.com"
End If

This is great providing your not using Exchange '03 Enterprise. For any
user created after the implementation of Exchange '03 my output looks like
this
From Active Directory/cn=Joe S. (e-mail address removed)
instead of this
(e-mail address removed)

I next tried the following code:
strEmail = Application.GetAddress(strPickName, "<PR_SURNAME>", , 2)
strEmailType = Application.GetAddress(strPickName, "<PR_GIVEN_NAME>", , 2)
strEmailType = Left(strEmailType, 1)
strEmail = strEmailType & strEmail & "@nospam.com"
But if someone has the last name with a space (e.g. den Daas) that won't
work either.

Does anyone no another way to get an email address from exhange? Maybe
using the alias or the smtp address?

thanks,
 

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