Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Searching SentItems for DisplayName instead of Email Address

$
0
0

I have an EWS application that searches the SentItems folder for emails after a certain date, and by specific email addresses. I’m having a problem in finding messages that I have responded to as opposed to new messages.

Example: I’m sending a new message to John Smith, so I send a message to johnsmith@someisp.net

In my code, I’m using the following logic to search the SentItems folder for any messages sent to John:

Dim lstEmailAddrTo As New List(Of SearchFilter)
For Each strEmailAddress As String In 	lstEmailAddr.AsEnumerable
  lstEmailAddrTo.Add(New SearchFilter.ContainsSubstring(EmailMessageSchema.DisplayTo, strEmailAddress))
  lstEmailAddrTo.Add(New SearchFilter.ContainsSubstring(EmailMessageSchema.DisplayCc, strEmailAddress))
Next

Dim sfltrEmailAddrTo As SearchFilter = New SearchFilter.SearchFilterCollection(LogicalOperator.Or, lstEmailAddrTo.ToArray())

Dim lstSentItems As New List(Of SearchFilter)
lstSentItems.Add(New SearchFilter.IsGreaterThanOrEqualTo(ItemSchema.DateTimeSent, dteSent))
lstSentItems.Add(sfltrEmailAddrTo)

Dim sfltrSentItems As SearchFilter = New SearchFilter.SearchFilterCollection(LogicalOperator.And, lstSentItems.ToArray())

The problem is that it is not picking up messages that I have responded to a message from John…When I manually view the MailItem in Outlook, it appears that Outlook creates a "Contact" like entry and instead of 'johnsmith@someisp.net' in theTo field , it displays 'john smith'

Any ideas would be greatly appreciated.
Thank you in advance for your time.

Sincerely,
Paul Goldstein


Paul D. Goldstein Forceware Systems, Inc.


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>