Help!

Items.Find -> To -> With mutliple e-mails

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA RSS
Next:  making a cell resize itself to accommodate data  
Author Message
GregR
External


Since: Nov 04, 2009
Posts: 1



PostPosted: Wed Nov 04, 2009 3:11 pm    Post subject: Items.Find -> To -> With mutliple e-mails
Archived from groups: microsoft>public>outlook>program_vba (more info?)

I'm trying to do a find against a folder, on the "to" field, against a bunch
of e-mails. If the "To" has one e-mail, it works fine. If it has more than
one (e.g., greg DeleteThis @test1.com; greg DeleteThis @test2.com; greg DeleteThis @test3.com) it doesn't work.

Example:


_MailItem mailItemTest = oItems.Find("[To] = 'greg@test1.com'") as _MailItem;

(The above oItems points to a valid folder).

So with this example, any messages in the folder that have a single "to" of
"greg@test1.com" will return the first found (and FindNext the next). If any
of the messages in the folder contain "greg@test1.com" and any other e-mails
in the to, that message is not returned.

I'm trying to find all e-mails with a "to" of a specific address - but most
will have that one plus others.

Any ideas here? I tried wild carding it, without luck. I've written code
to iterate through and do my own search, but the folder can have a lot of
e-mails, so that is very slow and I quickly run into the outlook connect
limit.

Thanks,
-Greg
Back to top
Ken Slovak - [MVP - Outlo
External


Since: Oct 17, 2003
Posts: 3355



PostPosted: Thu Nov 05, 2009 10:19 am    Post subject: Re: Items.Find -> To -> With mutliple e-mails [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Outlook version? Even if this isn't for Outlook 2007 where you can use the
new content searching you can use SQL syntax in a Find/Restrict by prefacing
the SQL search with "@SQL=".

In that case you use the DASL property tag, so it would be
"http://schemas.microsoft.com/mapi/proptag/0x0E04001E" or
"urn:schemas:httpmail:displayto". The filter would look something like this:

string filter = "@SQL=" + "\"" + "urn:schemas:httpmail:displayto" + "\"" + "
LIKE '%greg@test1.com%' ";

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"GregR" <GregR.DeleteThis@discussions.microsoft.com> wrote in message
news:B00BEEB9-33C4-4874-961F-437AB4167600@microsoft.com...
> I'm trying to do a find against a folder, on the "to" field, against a
> bunch
> of e-mails. If the "To" has one e-mail, it works fine. If it has more
> than
> one (e.g., greg.DeleteThis@test1.com; greg.DeleteThis@test2.com; greg.DeleteThis@test3.com) it doesn't
> work.
>
> Example:
>
>
> _MailItem mailItemTest = oItems.Find("[To] = 'greg@test1.com'") as
> _MailItem;
>
> (The above oItems points to a valid folder).
>
> So with this example, any messages in the folder that have a single "to"
> of
> "greg@test1.com" will return the first found (and FindNext the next). If
> any
> of the messages in the folder contain "greg@test1.com" and any other
> e-mails
> in the to, that message is not returned.
>
> I'm trying to find all e-mails with a "to" of a specific address - but
> most
> will have that one plus others.
>
> Any ideas here? I tried wild carding it, without luck. I've written code
> to iterate through and do my own search, but the folder can have a lot of
> e-mails, so that is very slow and I quickly run into the outlook connect
> limit.
>
> Thanks,
> -Greg
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum