AddressEntry.AddressEntryUserType property (Outlook)
expression A variable that represents an AddressEntry object.
AddressEntryUserType provides a level of granularity for user types that is finer than that of AddressEntry.DisplayType. The DisplayType property does not distinguish users with different types of AddressEntry, such as an AddressEntry that has a Simple Mail Transfer Protocol (SMTP) email address, a Lightweight Directory Access Protocol (LDAP) address, an Exchange user address, or an AddressEntry in the Outlook Contacts Address Book. All these entires have olUser as their AddressEntry.DisplayType.
The following code sample shows how to obtain the business phone number, office location, and job title for all Exchange user entries in the Exchange Global Address List. It first uses AddressList.AddressListType to find the Global Address List. Since the Global Address List can contain multiple types of entries such as Exchange user, Exchange distribution list, and Exchange public folder, for each AddressEntry on that AddressList, the code sample uses AddressEntryUserType to verify if the AddressEntry represents an Exchange user. After it finds an Exchange user, it obtains and prints the various pieces of data for the user.
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
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.