Outlook.DistListItem question

  • Thread starter Thread starter Paul M
  • Start date Start date
P

Paul M

I have a question i cant seem to figure out..

Dim d As Outlook.DistListItem

d = DirectCast(objMAPIFolder.Items.Item(lngItemCount), Outlook.DistListItem)


I have managed to loop through the contacts and find the distribution lists
item, which are then placed into the object above, but i cant find a
property which will show me the email addresses that exist within the
distribution list???

any help appreciated,

Paul.
 
The DistListItem.GetMember returns a Recipient object, which will have the
address in it. GetMember takes the index as an argument.

An alternative method to get all the addresses at once might be to use the
DistListItem.SaveAs method to save the DL as a text file, then parse the
text file, which will contain a couple of heading lines, then a neat
tab-delimited list that probably could easily be read into an array.
 
Sue,

thanks for your reply.
I have tried the SaveAs method and it exports it into a file, but there is
alot of rubbish within the textfile, and the email addresses mixed in also.
I did a search on the SaveAs method to see what input parameter i can place
for the "type as Object", but had no luck

How can i read this file in the easiest possible way?

thanks,
Paul.
 
From the Help topic on SaveAs:

"Type Optional Variant. The file type to save. Can be one of the
following OlSaveAsType constants: olHTML, olMSG, olRTF, olTemplate, olDoc,
olTXT, olVCal, olVCard, olICal, or olMSGUnicode."

What you want is olTxt (literal 0). If you use that, the resulting file
should be as I described earlier. You can use FileSystemObject methods to
read it into a string variable and then apply normal text parsing
techniques.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top