code_junkie

Outlook/Exchange - how to programmatically export users in distribution list?

Nov 12th, 2011
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. Const olFolderContacts = 10
  2.  
  3. Set objOutlook = CreateObject("Outlook.Application")
  4. Set objNamespace = objOutlook.GetNamespace("MAPI")
  5.  
  6. Set colContacts = objNamespace.GetDefaultFolder(olFolderContacts).Items
  7. intCount = colContacts.Count
  8.  
  9. For i = 1 To intCount
  10. If TypeName(colContacts.Item(i)) = "DistListItem" Then
  11. Set objDistList = colContacts.Item(i)
  12. Wscript.Echo objDistList.DLName
  13. For j = 1 To objDistList.MemberCount
  14. Wscript.Echo objDistList.GetMember(j).Name & " -- " & _
  15. objDistList.GetMember(j).Address
  16. Next
  17. Wscript.Echo
  18. End If
  19. Next
Add Comment
Please, Sign In to add comment