简体   繁体   中英

How to mark email as read using java ews api

I am using java ews API to update the email as read. However didn't able to find right method to update mail.

Using EWS java API :

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);
ExchangeCredentials credentials = new WebCredentials("USERNAME", "PASSWORD");       
try {
    service.setCredentials(credentials);
    service.setUrl(new URI("URL"));
    ItemId id = new ItemId("ITEM ID");
    new Item(service);
    Item item = Item.bind(service, id);
    EmailMessage email = (EmailMessage) item;
    if (ewsModel.getMarkEmailAsRead().booleanValue()) {
        email.setIsRead(true);
        email.update(ConflictResolutionMode.AlwaysOverwrite);           
    }}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM