exchangewebservices - Exchange Web Services: Finding emails sent to a recipient -
i'm using exchange web services connect mailbox , messages matching criteria, using finditems searchfilter.
i can emails in mailbox filtering on 'from' email address this:
var service = new exchangeservice(exchangeversion.exchange2010_sp1) { traceenabled = true, credentials = new webcredentials(username, password) }; var filter = new searchfilter.containssubstring(emailmessageschema.from, "some@email.com"); service.finditems(wellknownfoldername.inbox, filter, new itemview(50)) and can filter on displayto property this:
var filter = new searchfilter.containssubstring(emailmessageschema.displayto, "display name"); but far can tell searches recipient's display name. want search on email address or domain name.
this doesn't return results when expect to:
var filter = new searchfilter.containssubstring(emailmessageschema.torecipients, "some@email.com"); is possible find emails recipients list contains specified email address?
it might because don't access correct folder, ie: sent items.
replace
service.finditems(wellknownfoldername.inbox, filter, new itemview(50)) by
service.finditems(wellknownfoldername.sentitems, filter, new itemview(50)) edit: misunderstood initial question. maybe should have @ following msdn blog: http://blogs.msdn.com/b/akashb/archive/2010/03/05/how-to-build-a-complex-search-using-searchfilter-and-searchfiltercollection-in-ews-managed-api-1-0.aspx explains how make complex searches using ews
Comments
Post a Comment