c# - Getting unique emails EWS Manged Web API -
i trying retrieve emails exchange server using below code:
exchangeservice service = new exchangeservice(exchangeversion.exchange2007_sp1); service.credentials = new webcredentials("username", "somepassword"); service.traceenabled = true; service.traceflags = traceflags.all; service.autodiscoverurl("username", redirectionurlvalidationcallback); finditemsresults<item> findresults = service.finditems(wellknownfoldername.inbox, new itemview(10)); serviceresponsecollection<getitemresponse> items = service.bindtoitems(findresults.select(item => item.id), new propertyset(basepropertyset.firstclassproperties, emailmessageschema.from, emailmessageschema.torecipients)); return items.select(item => { return new mailitem() { = ((microsoft.exchange.webservices.data.emailaddress)item.item[emailmessageschema.from]).address, recipients = ((microsoft.exchange.webservices.data.emailaddresscollection)item.item[emailmessageschema.torecipients]).select(recipient => recipient.address).toarray(), subject = item.item.subject, body = item.item.body.tostring(), }; }).toarray();
i need save subject , body in database . need unique emails becasue don't want redundant emails display on system.
means every time synchronize system exchange server , new emails hadn't synchronized yet.
thanks
if understand right, save emails obtained ews in database. later obtain emails again , email have plus new ones?
how working timestamps? creationtime (or receivedtime) of mailitem , save in database too.
after search in ews mailitems have creationtime (or receivedtime) later last creationtime (or receivedtime) in database. new emails.
Comments
Post a Comment