A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Getting SMTP from Distribution List Members



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 18th 08, 01:51 PM posted to microsoft.public.outlook.program_vba
McKilty
external usenet poster
 
Posts: 11
Default Getting SMTP from Distribution List Members

On Aug 15, 6:50 pm, "Dmitry Streblechenko" wrote:
That *is* the actual e-mail address, but its type happens to be "EX", not
"SMTP".
You will need to read the PR_EMS_AB_PROXY_ADDRESSES property using
objAddrEntry.Fields[].

--
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-"McKilty" wrote in message

...

I need to loop every Distribution List and get the names and SMTP
address of each member. Instead of the I am
getting /o=SomeCompany/ou=Domain/cn=Recipients/cn=RJones.


How can I get the actual e-mail address?


The code I'm using:


Private Sub Command1_Click()


Dim objSession As MAPI.Session
Dim objAddrList As MAPI.AddressList
Dim objAddrEntries As MAPI.AddressEntries
Dim objAddrEntry As MAPI.AddressEntry
Dim objDistMembers As MAPI.AddressEntries
Dim objDistMember As MAPI.AddressEntry


Open "C:\DL.txt" For Output As #1


Set objSession = CreateObject("MAPI.Session")
objSession.Logon ("Outlook")


Set objAddrList = objSession.GetAddressList(CdoAddressListGAL)
'Move through the users and distribution lists in the PAB
Set objAddrEntries = objAddrList.AddressEntries
Set objAddrEntry = objAddrEntries.GetFirst
Do Until objAddrEntry Is Nothing
With objAddrEntry
Select Case .DisplayType
Case 1
'Move through the distribution list members
Set objDistMembers = .Members
Set objDistMember = objDistMembers.GetFirst
Print #1, objAddrEntry.Name
Do Until objDistMember Is Nothing '
Print #1, Chr(9) & objDistMember.Name & Chr(9) &
objDistMember.Address
Set objDistMember = objDistMembers.GetNext
Loop
End Select
End With
Set objAddrEntry = objAddrEntries.GetNext
Loop


Close #1


Set objDistMember = Nothing
Set objDistMembers = Nothing
Set objAddrEntries = Nothing
Set objAddrEntry = Nothing
Set objAddrList = Nothing
Set objSession = Nothing


End Sub


Yeah, I figured I would be using the wrong terminology. Looking at my
code, is it simple to incorporate that code? I'm going to give it a
shot, but I'm pretty rusty...
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to count the members of a distribution list? Alan Outlook - General Queries 1 April 16th 08 04:00 PM
can the members of distribution list be hidden? DumbCluck Outlook - Using Contacts 1 April 11th 07 03:39 PM
Members of Distribution List cannot be found Tom Outlook - Using Contacts 5 February 21st 07 02:57 AM
Exporting Members on a distribution list WooYing Outlook - Using Contacts 3 September 29th 06 06:08 AM
members missing from distribution list EZim Outlook - Using Contacts 0 March 20th 06 05:04 PM


All times are GMT +1. The time now is 04:18 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.