AddressListType = LDAP Woes

Status
Not open for further replies.

JFClark

New Member
Outlook version
Outlook 2013 32 bit
Email Account
Outlook.com (as MS Exchange)
Greetings SlipStick world.

While searching for a way to extract information from out Exchange Server, I came across this bit of code from this Site:

Code:
Sub DemoAE()
    Dim colAL As Outlook.AddressLists
    Dim oAL As Outlook.AddressList
    Dim colAE As Outlook.AddressEntries
    Dim oAE As Outlook.AddressEntry
    Dim oExUser As Outlook.ExchangeUser
    
    Set colAL = Application.Session.AddressLists
    
    For Each oAL In colAL
        'Address list is an Exchange Global Address List
        If oAL.AddressListType = olExchangeGlobalAddressList Then
            Set colAE = oAL.AddressEntries
            For Each oAE In colAE
                If oAE.AddressEntryUserType = _
                    olExchangeUserAddressEntry Then
                    Set oExUser = oAE.GetExchangeUser
                    Debug.Print (oExUser.JobTitle)
                    Debug.Print (oExUser.OfficeLocation)
                    Debug.Print (oExUser.BusinessTelephoneNumber)
                End If
            Next
        End If
    Next
End Sub

It works very well except it ignored the one address book I was trying to work with. After playing with the code and some strategic use of Debug.Print, I was able to determine that this code ignores any address list that does not equal olExchangeGlobalAddressList (Enum 0). The address book I tried to use is in fact olOutlookLdapAddressList (Enum 3)

I removed that IF...End If bit and the code did fine until it got the the LDAP address book and it threw an error. Apologies, I did not write it down and my notes are at work. If that detail is needed I can add it in when I get back to work. My question is WHY does the AddessListType HAVE to be a certain type and since it obviously matters, HOW do I get the same info from a LDAP address book?

Appreciate any assistance...

John
 
Now slow down everyone...talk all talk at once! :)
 
Status
Not open for further replies.
Similar threads

Similar threads

Back
Top