2015-11-03 49 views
0

我有一個收集電子郵件收件箱,從多個系統獲取通知。我可以按主題和過程成功進行搜索,但希望通過發送給它的電子郵件地址進行搜索,因爲主題不斷變化。似乎只能通過顯示名稱進行搜索,這是收集框的名稱,但我發送給別名。 [email protected],[email protected],[email protected] 全部指向一個集合帳戶。AQS搜索EWS發送到電子郵件地址

我想這項工作

FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, "to:'[email protected]'", new ItemView(10)); 

,然後我可以根據發送設置不同的處理來解決。

我試圖設置一個SearchFilter,但ItemSchema似乎並沒有提供SentTo,只有DisplayTo。

SearchFilter.ContainsSubstring sentToFilter = new SearchFilter.ContainsSubstring(ItemSchema.DisplayTo, "[email protected]", ContainmentMode.Substring, ComparisonMode.IgnoreCase); 
FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, sentToFilter, new ItemView(10)); 

這是我找到的搜索選項可以在查詢 https://msdn.microsoft.com/en-us/library/office/dn579420(v=exchg.150).aspx

回答

0

感謝@武果汁導致我的EmailMessageSchema我能找到在InternetMessageHeaders架構發送到

SearchFilter.ContainsSubstring sentToFilter = new SearchFilter.ContainsSubstring(EmailMessageSchema.InternetMessageHeaders, "[email protected]", ContainmentMode.Substring, ComparisonMode.IgnoreCase); 
FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, sentToFilter, new ItemView(10)); 
相關問題