View Single Post
  #4  
Old February 22nd 10, 06:07 PM posted to microsoft.public.outlook.program_vba
Salad
external usenet poster
 
Posts: 24
Default MailItem Find Method question

Dmitry Streblechenko wrote:

Under the hood, Outlook searches on the PR_NORMALIZED_SUBJECT (which does
not include the prefix), not PR_SUBJECT.
Where does the strSubject come from? Do you actually store it? Or does the
user type it?


In Access, one can do a File/Import/GetExternalData and link an inbox,
sent, etc folder and it's now a table, similar to an Excel spreadsheet.
So I'm using info from the inbox in my testing.

One of the fields is "Subject" that contains the entire subject line
" Test". Another field is "Subject Prefix" with just the "", and
"Normalized Subject" that contains "Test"

Besides the subject fields , there's also the
received/created/lastmodified columns, the email size, sender name, and
a few other fields like the body.

I thought it'd be relatively simple to find the email.
Works like a champ on the normalized subject as you noted.
I can'r find the email if the subject line is null.
I can't find the email based on any datetime stamp.
Works like a champ on message size.

But I figure there can be one or more emails with the same subject line,
same message size, or same datetimestamp. But all three? I don't think so.

Since the .Find method works fine on the subject and size fields, I'm
obviously passing the wrong filter for a null (blank) subject and for
the date.

I've tried, and failed on
.Find("IsEmpty([Subject]")
.Find("IsNull([Subject]")
.Find("[Subject] = ''")
and for dates
'Set objMail = .Find("[ReceivedTime]= '1/1/2010 3:34:00 AM'")
and Jan 1, 2010, January 1,2010, no seconds, no AM, just the date,
nothing works. Single quotes, double quotes, it doesn't seem to matter.

Based on the above, do you spot anything obvious that is in error? Or
other tests I could make? Or a link to compare my code to for finding
an email?



Ads