Question

How can I specify the SearchFilter with Java EWS library to fetch mail from a specific user?

In microsoft.exchange.webservices.data.ItemSchema, I could find something like "IsFromMe" but this will check for current User.

Thanks in advance.

Était-ce utile?

La solution

The From/To type information isn't on ItemSchema it's on EmailMessageSchema. Call would look something like this:

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));    
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top