Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 649
Adam Avatar asked Mar 05 '26 23:03

Adam


1 Answers

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));
like image 67
SANN3 Avatar answered Mar 07 '26 12:03

SANN3



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!