Outlook) (AddressEntry.AddressEntryUserType 屬性

從 OlAddressEntryUserType 列舉中傳回常數,代表 AddressEntry 的使用者類型。 唯讀。

語法

expression。 AddressEntryUserType

運算式 代表 AddressEntry 物件的變數。

註解

AddressEntryUserType 為使用者類型提供比 AddressEntry.DisplayType 更精細的細微層級。 DisplayType 屬性不會區分具有不同類型 AddressEntry 的使用者,例如具有簡易郵件傳輸通訊協定 (SMTP) 電子郵件地址的 AddressEntry、輕量型目錄存取通訊協定 (LDAP) 位址、Exchange 使用者位址或 Outlook 連絡人通訊錄中的 AddressEntry。 所有這些整體都有 olUser 做為其 AddressEntry.DisplayType。

範例

在下列程式碼範例中,會顯示如何取得 Exchange 全域通訊清單中所有 Exchange 使用者項目的商務電話號碼、辦公室位置及職稱。 它首先使用 AddressList.AddressListType 來尋找全域通訊清單。 因為 [全域通訊清單] 可以含有多個類型的項目,例如 Exchange 使用者、Exchange 通訊群組清單及 Exchange 公用資料夾,所以對於該 AddressList 上的每個 AddressEntry,程式碼範例都會使用 AddressEntryUserType 驗證 AddressEntry 是否代表 Exchange 使用者。 找到 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

另請參閱

AddressEntry 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。