Extract email addresses from Distribution LIst in Global Address List

T

tthomas

Greetings,
I am using CDO.Message to send email messages from my access application. I
now
need to send email to existing distribution lists in our Global Address List.
However, our exchange server blocks sending to distribution list (i.e.
distribution list is named MyDistList and its email address is
(e-mail address removed)) from SMTP email.

I have searched in vain for an example of VBA that will extract the email
addresses of members of a distribution list from the Global Address List with
a specific name. (I have found code that will use a DL in the contacts but
that doesn't help). I've searched at length thru slipstick, google, etc.
Can anyone help?

much thanks
Teresa
 
S

Sue Mosher [MVP-Outlook]

CDO for Windows (which is what CDO.Message) implies cannot help you with this. Either use ADSI methods or CDO 1.21 or Redemption. The code sample at http://www.cdolive.com/cdo5.htm#DeleteDLMember shows one way of working with GAL DL members with CDO 1.21.

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

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

tthomas via OfficeKB.com

Thanks for the direction...after a lot of fumbling..this is what we came up
with...

Public Function ADLIST(DistName As String) As String
Dim strValue As Variant, EmailMe As String
Set getDn = GetObject("LDAP://CN=" & DistName & ",OU=Distribution
Groups,DC=gunnallen,DC=com")
strAllValues = getDn.getex("member")
For Each strValue In strAllValues
Set getDn2 = GetObject("LDAP://" & strValue)
strEmail = getDn2.getex("mail")
EmailMe = EmailMe & IIf(Len(EmailMe) = 0, "", ", ") &
strEmail(0)
Next
Set strAllValues = Nothing
Set strEmail = Nothing
ADLIST = EmailMe
End Function

CDO for Windows (which is what CDO.Message) implies cannot help you with this. Either use ADSI methods or CDO 1.21 or Redemption. The code sample at http://www.cdolive.com/cdo5.htm#DeleteDLMember shows one way of working with GAL DL members with CDO 1.21.
Greetings,
I am using CDO.Message to send email messages from my access application. I
[quoted text clipped - 12 lines]
much thanks
Teresa
 

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