簡體   English   中英

如何從Outlook加載項中的Exchange郵箱中讀取自定義屬性

[英]How to read Custom Attributes from Exchange mailbox in Outlook Add-in

用戶使用Outlook 2013並在Office365中擁有帳戶。 我想在Outlook中創建類似通訊錄的窗口。 因此,我創建了新的Outlook 2013加載項以顯示用戶列表。 代碼如下:

var list = Globals.ThisAddIn.Application.Session.GetGlobalAddressList();
var users = list.AddressEntries.Cast<AddressEntry>()
                .Where(ae => ae.AddressEntryUserType == OlAddressEntryUserType.olExchangeUserAddressEntry).ToList());

而且有效。 但是,作為交換,郵箱具有“自定義屬性”,並且設置了一些主題。 我想在列表中顯示此屬性,但是我不知道如何檢索它們。

在Powershell中,您可以執行以下操作:

Get-Mailbox -Identity alexB | FL

並且您可以看到該對象具有“ CustomAttribute1”,“ CustomAttribute2”,...等屬性。如何在Outlook加載項中執行相同的操作。

在許多OutlookSpy搖籃中,我發現了這個問題:)要獲取自定義屬性6,必須調用:

var prope = user.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x8032001E");

屬性:

  • #7 = 0x8033001E
  • #8 = 0x8034001E
  • ...

Outlook對象模型不提供任何屬性或屬性方法。 您可以嘗試使用任何低級屬性瀏覽器(例如MFCMAPI或Outlook Spy)來觀察隱藏的屬性。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM