ExchangeUser Object (Outlook)

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

Version Information

Version Added: Outlook 2007

Remarks

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.

Example

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 
 
 Debug.Print(oExUser.JobTitle) 
 
 Debug.Print(oExUser.OfficeLocation) 
 
 Debug.Print(oExUser.BusinessTelephoneNumber) 
 
 End If 
 
 Next 
 
 End If 
 
 Next 
 
End Sub

See Also

Concepts

ExchangeUser Object Members

Outlook Object Model Reference