ExchangeUser.GetMemberOfList method (Outlook)

Returns an AddressEntries collection object that contains the AddressEntry objects representing all the Exchange distribution lists to which the user belongs.

Syntax

expression. GetMemberOfList

expression A variable that represents an ExchangeUser object.

Return value

An AddressEntries collection object that represents the Exchange distribution lists to which the ExchangeUser belongs. Returns an AddressEntries collection object with a count of zero (0) if the ExchangeUser is not a member of any Exchange distribution list.

Remarks

GetMemberOfList is an expensive operation in terms of performance if there is a slow connection to Exchange Server.

Example

The following code sample shows how to obtain the names of the Exchange distribution lists to which the manager of the current user belongs. It uses the ExchangeUser object to obtain specific Exchange user information such as the user's Exchange account alias, details about the user's manager, and the distribution lists that the user's 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 

See also

ExchangeUser Object

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.