EWS从Java中的特定用户获取读/未读邮件

时间:2014-02-15 08:31:44

标签: java exchangewebservices ewsjavaapi

如何使用Java EWS库指定SearchFilter以从特定用户获取邮件?

microsoft.exchange.webservices.data.ItemSchema中,我可以找到类似“IsFromMe”的内容,但这会检查当前用户。

提前致谢。

1 个答案:

答案 0 :(得分:2)

发件人/收件人类型信息不在ItemSchema EmailMessageSchema上。电话会看起来像这样:

ExchangeService service = new ExchangeService();
//login to your exchange server with credentials etc & set your service url
.....

//issue your search for a given user using EmailMesssageSchema.From  
FindItemsResults <Item> results = service.findItems(WellKnownFolderName.Inbox, 
new SearchFilter.IsEqualTo(EmailMessageSchema.From, "SomeUser"), new ItemView(100));