List the Groups that My Manager Belongs to
This topic describes how to obtain the names of the Exchange distribution lists that the manager of the current user belongs to. 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:
Obtain the current user's ExchangeUser object. Use the GetExchangeUser method of the AddressEntry object for the current user to get the ExchangeUser object that represents the current user.
Obtain the distribution lists that the user's manager has joined.Use the ExchangeUser methods GetExchangeUserManager and GetMemberOfList to find these distribtution lists. Use the ExchangeDistributionList object to obtain further information about a distribution list, such as its display name.
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
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.