ExchangeDistributionList object (Outlook)
The ExchangeDistributionList object provides detailed information about an AddressEntry that represents an Exchange distribution list.
Remarks
ExchangeDistributionList is a derived class of AddressEntry, and is returned instead of an AddressEntry when the caller performs a QueryInterface on the AddressEntry.
The AddressEntry.Members property supports enumerating members of a distribution list. ExchangeDistributionList adds the first-class properties for Alias, Comments, and PrimarySmtpAddress. You can also access other properties specific to the Exchange distribution list that are not exposed in the object model through the PropertyAccessor object.
Some properties such as Comments are read-write properties. Setting these properties requires the code to be running under an appropriate Exchange administrator account; without sufficient permissions, calling the ExchangeUser.Update method will result in a "permission denied" error.
Example
The following code sample shows how to obtain the names of the Exchange distribution lists that the current user's manager belongs to. It uses the ExchangeUser.GetExchangeUserManager method to obtain information about the user's manager, and uses ExchangeUser.GetMemberOfList to obtain the distribution lists (represented by ExchangeDistributionList objects) that the manager has joined.
Sub ShowManagerDistLists()
Dim oAE As Outlook.AddressEntry
Dim oExUser As Outlook.ExchangeUser
Dim oDistListEntries As Outlook.AddressEntries
'Obtain the AddressEntry for CurrentUser
Set oExUser = _
Application.Session.CurrentUser.AddressEntry.GetExchangeUser
'Obtain distribution lists that the user's manager has joined
Set oDistListEntries = oExUser.GetExchangeUserManager.GetMemberOfList
For Each oAE In oDistListEntries
If oAE.AddressEntryUserType = _
olExchangeDistributionListAddressEntry Then
Debug.Print (oAE.name)
End If
Next
End Sub
Methods
Properties
Name |
---|
Address |
AddressEntryUserType |
Alias |
Application |
Class |
Comments |
DisplayType |
ID |
Name |
Parent |
PrimarySmtpAddress |
PropertyAccessor |
Session |
Type |
See also
Outlook Object Model Reference
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.