ExchangeUser Object (Outlook)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Provides detailed information about an AddressEntry that represents a Microsoft Exchange mailbox user.

ExchangeUser is derived from the AddressEntry object, and is returned instead of an AddressEntry when the caller performs a query interface on the AddressEntry object.

This object provides first-class access to properties applicable to Exchange users such as FirstName, JobTitle, LastName, and OfficeLocation. You can also access other properties specific to the Exchange user that are not exposed in the object model through the PropertyAccessor object. Note that some of the explicit built-in properties are read-write properties. Setting these properties requires the code to be running under an appropriate Exchange administrator account; without sufficient permissions, calling the ExchangeUser.Update method will result in a "permission denied" error.

The following code sample shows how to obtain the business phone number, office location, and job title for all entries in the Exchange Global Address List.

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 
 End If 
 End If 
End Sub