Ews Java API 正在发送电子邮件

Ews Java API Getting Sent emails

我正在使用 EWS Java API(2.0 版)在 Java

中获取交换电子邮件

我想从交换箱中提取发送到此电子邮件地址 ("rams@mydomain.com") 的所有邮件

这是我的示例代码

 String email = "rams@mydomain.com"
 ItemView itemView = new ItemView(1000);


 SearchFilter.SearchFilterCollection searchFilterCollection1 = new SearchFilter.SearchFilterCollection(
                    LogicalOperator.Or
                    );
            SearchFilter searchFilter1 = new SearchFilter.ContainsSubstring(EmailMessageSchema.DisplayCc, email);
            SearchFilter searchFilter2 = new SearchFilter.ContainsSubstring(EmailMessageSchema.DisplayTo, email);
            searchFilterCollection1.add(searchFilter1);
            searchFilterCollection1.add(searchFilter2);
            FindItemsResults<Item> items = exService.findItems(WellKnownFolderName.SentItems,searchFilterCollection1,itemView);

我没有遇到任何异常。我没有收到任何电子邮件,但实际上电子邮件存在于服务器中。

谢谢

您是否尝试过使用查询字符串查看“参与者”字段?

String email = "rams@mydomain.com";
ItemView itemView = new ItemView(1000);

var queryString = String.Format("(From:=%1$s OR Participants:=%1$s)", email);

FindItemsResults<Item> items = exService.findItems(WellKnownFolderName.SentItems, 
                                                  queryString, itemView);