'get manager info from Outlook Address List vba

I'm using the below code to open the Global Address List window to select a contact in the list.

For the contact that is selected, I'd like to get the Manager name as well. However, I can't seem to get it to work.

Any recommendations?

Private Sub accountManagerName_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    Dim CDOSession, cdoAddressBook, olkRecipients, objAE

    On Error Resume Next
    Set CDOSession = CreateObject("MAPI.Session")
'   Change the name of your Outlook profile as needed.
    CDOSession.Logon "", "", False, False
    Set olkRecipients = CDOSession.AddressBook(, "Global Address List", 0, False)
    For Each objAE In olkRecipients
        accountManagerName.Text = objAE.name
        'ccManager.Caption = objAE.Manager.name
    Next
    Set olkRecipients = Nothing
    CDOSession.Logoff
    Set CDOSession = Nothing
End Sub


Solution 1:[1]

In case of Outlook Object Model, use AddressEntry.Manager property.

CDO 1.21 does not expose address entry's manager, but you can use Redemption (I am its author) and its RDO family of objects (it offers a complete replacement of the CDO 1.21 library and can run both under Outlook and the standalone version of MAPI) - it exposes the RDOAddressEntry.Manager property.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1