ExchangeDistributionList 物件會提供代表 Exchange 通訊群組清單之 AddressEntry 的詳細資訊。
註解
ExchangeDistributionList 是 AddressEntry 的衍生類別,當呼叫者在 AddressEntry 上執行 QueryInterface 時,會傳回它而不是 AddressEntry。
AddressEntry.Members 屬性支援列舉通訊群組清單的成員。 ExchangeDistributionList 會新增 Alias、Comments 及 PrimarySmtpAddress 的最高類別屬性。 您也可以透過 PropertyAccessor 物件存取未在物件模型中公開的 Exchange 通訊群組清單特定其他屬性。
部分屬性例如 Comments 是可讀寫屬性。 設定這些屬性需要以適當的 Exchange 系統管理員帳戶執行程式碼;在沒有足夠權限的情況下,呼叫 ExchangeUser.Update 方法會導致「拒絕權限」錯誤。
範例
下列程式碼範例會顯示如何取得目前使用者之主管所屬的 Exchange 通訊群組清單名稱。 它使用 ExchangeUser.GetExchangeUserManager 方法獲取有關使用者管理員的資訊,並使用 ExchangeUser.GetMemberOfList 獲取由管理員已加入的 ExchangeDistributionList 物件 (代表的通訊群組清單) 。
Sub ShowManagerDistLists()
Dim oAE As Outlook.AddressEntry
Dim oExUser As Outlook.ExchangeUser
Dim oDistListEntries As Outlook.AddressEntries
'Obtain the AddressEntry for CurrentUser
Set oExUser = _
Application.Session.CurrentUser.AddressEntry.GetExchangeUser
'Obtain distribution lists that the user's manager has joined
Set oDistListEntries = oExUser.GetExchangeUserManager.GetMemberOfList
For Each oAE In oDistListEntries
If oAE.AddressEntryUserType = _
olExchangeDistributionListAddressEntry Then
Debug.Print (oAE.name)
End If
Next
End Sub
方法
屬性
| 名稱 |
|---|
| Address |
| AddressEntryUserType |
| Alias |
| Application |
| Class |
| Comments |
| DisplayType |
| ID |
| 名稱 |
| Parent |
| PrimarySmtpAddress |
| PropertyAccessor |
| Session |
| Type |
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。