Those are essentially the same results I reported, except that as far as I
could tell, with the first query, I got all messages sent to the gmail.com
domain, not just some, regardless of whether that string was in the display
name. I can't duplicate your "very small fraction" result.
Messages in your own Sent Items folder won't have any Internet headers. You
should be able to see that with Outlook Spy or MFCMAPI.exe.
The alternative is to iterate the Recipients collection for each item and
examine each Recipient.Address.
Sue Mosher
"Randall" <r_no_spam_gouge@doncar_no_spam_sys.com> wrote in message
news:erKKLMXXKHA.408@TK2MSFTNGP04.phx.gbl...
> Good to see it is not dependent on the datastore.
> I used the filter view in Outlook 2007, that I now know how to use, and
> used the To field on the messages tab. The SQL for the query is the same
> as yours and returns all mail with emailaddress in the To field and also
> returns some messages (a very small fraction) of messages where the name
> associated with the email address is displayed in the To field.
> ("http://schemas.microsoft.com/mapi/proptag/0x0e04001f" CI_STARTSWITH
> 'emailaddress' OR "http://schemas.microsoft.com/mapi/proptag/0x0e03001f"
> CI_STARTSWITH 'emailaddress')
> This returns only mail with the emailaddress in the To field
> ("http://schemas.microsoft.com/mapi/proptag/0x0e04001f" LIKE
> '%emailaddress%' OR "http://schemas.microsoft.com/mapi/proptag/0x0e03001f"
> LIKE '%emailaddress%')
> I would have thought that since the email addresses are in the header of
> the message that "urn:schemas:mailheader:to" would contain the string of
> recipients but this comes back with no results.
> I'm not sure what all is available .... but if there are alternate methods
> of obtaining this list of recipients in code I would be willing to look at
> doing that. Any thoughts would be appreciated.
> Thanks
> "Sue Mosher [MVP]" <suemvp@gmail.com> wrote in message
> news:%23RimUNVXKHA.1280@TK2MSFTNGP04.phx.gbl...
> > When it comes to viewing and manipulating data, Outlook generally doesn't
> > care what data store is involved.
>
>> Did you ever tell us your Outlook version? Which of my two search strings
> > did you try?
>
>> "Randall" <r_no_spam_gouge@doncar_no_spam_sys.com> wrote in message
> > news:OCqV9oPXKHA.5368@TK2MSFTNGP02.phx.gbl...
> >> Thanks for the info Sue ... but when I am performing the same search it
> >> appears to only be returning messages with the specified email address
> >> in the to or cc fields ... and not returning those for the same email
> >> address that only displayed a name.
> >
>>> Was hoping that was the answer as I was unaware that the sql was written
> >> for searches where the sql is not explicitly provided.
> >
>>> One other question. Is this information, being able to filter folders,
> >> only available where exhange is the mail sever?
> >
>>> Thanks in advance.
> >
>>
>>> "Sue Mosher [MVP]" <suemvp@gmail.com> wrote in message
> >> news:OaWxJiNXKHA.1372@TK2MSFTNGP02.phx.gbl...
> >>> Just using the built-in view Filter dialog and its SQL tab, I came up
> >>> with this in Outlook 2007:
> >>
>>>> ("http://schemas.microsoft.com/mapi/proptag/0x0e04001f"
> >>> CI_STARTSWITH '@gmail.com' OR
> >>> "http://schemas.microsoft.com/mapi/proptag/0x0e03001f" CI_STARTSWITH
> >>> '@gmail.com')
> >>
>>>> Odd that it would be CI_STARTSWITH instead of CI_PHRASEMATCH, but
> >>> that's what the SQL tab had. And the view showed all the gmail
> >>> addresses, regardless of whether that string was in the display name.
> >>
>>>> Then I modified it to use LIKE in case it's an earlier version or
> >>> unindexed, but that returned only those items that had @gmail.com in
> >>> the display name.
> >>
>>>> ("http://schemas.microsoft.com/mapi/proptag/0x0e04001f" LIKE
> >>> '%@gmail.com%' OR
> >>> "http://schemas.microsoft.com/mapi/proptag/0x0e03001f" LIKE
> >>> '%@gmail.com%')
> >>
>>>> These results make me wonder if the underlying email address is
> >>> available only for an indexed search.
> >
> >>
>>>> "Randall" <r_no_spam_gouge@doncar_no_spam_sys.com> wrote in message
> >>> news:O9W$5WMXKHA.3504@TK2MSFTNGP05.phx.gbl...
> >>>> Yes. As I mentioned in my note this only looks at the display name
> >>>> which can be anything and is not related to the actual email address.
> >>>
>>>>> What I am looking to do is this. Given an email address find all
> >>>> correspondences to this email address.
> >>>
>>>>> Thanks
> >>>
>>>>> "Michael Bauer " <mb@mvps.org> wrote in message
> >>>> news:10mr26ztm0gb2$.1xgb3entak4nm$.dlg@40tude.net...
> >>>>
>>>>>> Have your tried this:
> >>>>
>>>>>> urn:schemas:httpmail:displayto" LIKE '%emailaddress%'
> >>>>
>>>>
>>>>>> Am Mon, 2 Nov 2009 16:00:08 -0600 schrieb news.microsoft.com:
> >>>>
>>>>>>> I'm having a problem filtering the sent items folder by
> >>>>>> "urn:schemas:httpmail:to" LIKE '%emailaddress%' ... the search
> >>>>>> always
> >>>>>> returns nothing. Same is true for "urn:schemas:mailheader:to" LIKE
> >>>>>> '%emailaddress%'. I would use the displayto property but it is
> >>>>>> specific
> >>>>> to
> >>>>>> how an individual chooses to display a mail address unlike the email
> >>>>>> address.
> >>>>>
>>>>>>> Any help in obtaining a filter to provide a list of emails sent to
> >>>>>> an
> >>>>>> individual by email address would be appreciated.