Adam
Adam

Reputation: 777

Read only unread mails using EWS client

I am reading a mail using EWS.

Could you please let me know how to filter out only the unread mails from a inbox?

Upvotes: 3

Views: 3059

Answers (1)

SANN3
SANN3

Reputation: 10069

Try this code to get the unread mails from inbox

SearchFilter sf = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false));
findResults = service.findItems(WellKnownFolderName.Inbox,sf, new ItemView(20));

Upvotes: 6

Related Questions