开发者

Is there a way to extract email address from a Outlook distribution list?

Is there a way to extract email address from an Outlook Distribution list via script? I am looking for a way to extra开发者_如何学Pythonct all the email addresses from a Distribution list and output it to a CSV file.


If you mean through an Exchange server, find a solution with ADSI or LDAP through some MS tech page.

If you mean through Outlook Contacts, use Win32::OLE to get into MAPI and then loop through the contacts.


A few notes in VBScript:

Dim olApp ''Outlook.Application
Dim olMapi ''Outlook.NameSpace
Dim olFolder ''Outlook.MAPIFolder
Dim olItems ''Outlook.Items

olFolderContacts = 10

Set olApp = CreateObject("Outlook.Application")
Set olMapi = olApp.GetNamespace("MAPI")
Set olFolder = olMapi.GetDefaultFolder(olFolderContacts)
Set olItems = olFolder.Items

For i = 1 To olItems.Count
s = s & olItems(i).FullName & Chr(09) & olItems(i).Email1Address
Next 

MsgBox s
End Function

Here is a list of fields for contacts: http://support.microsoft.com/kb/313802


I don't know exactly how to get distribution lists, but this links should help you get started if you want to use vbscript: Programming examples for referencing items and folders in Outlook 2000

Or if you want to get distribution lists from Exchange rather than Outlook you might be able to use EWS: HOWTO: EWS: Consume Exchange Web Service from VBScript

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜