提供代表 Microsoft Exchange 信箱使用者之 AddressEntry 的詳細資訊。
註解
ExchangeUser 衍生自 AddressEntry 物件,當呼叫者在 AddressEntry 物件上執行查詢介面時,會傳回它而不是 AddressEntry。
此物件提供對 Exchange 使用者適用屬性的第一類存取,例如 FirstName、 JobTitle、 LastName 和 OfficeLocation。 您也可以透過 PropertyAccessor 物件存取未在物件模型中公開的 Exchange 使用者特定其他屬性。 請注意,部分明確內建屬性是可讀寫屬性。 設定這些屬性需要以適當的 Exchange 系統管理員帳戶執行程式碼;在沒有足夠權限的情況下,呼叫 ExchangeUser.Update 方法會導致「拒絕權限」錯誤。
範例
在下列程式碼範例中,會顯示如何取得 [Exchange 全域通訊清單] 中所有項目的商務電話號碼、辦公室位置及職稱。
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
方法
屬性
另請參閱
ExchangeUser 物件成員Outlook 物件模型參考
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。