Creating a search folder using VBA

E

Ebbe

Hi

I have a problem creating the search folder I want.
Using the normal way of creating a search folder, it is possible to search
for mails where subject contains (or not contains) a specific string.
BUT as far as I can see, it is not possible to specify a criterie, that says
"Subject must (or must not) begin/end with string xxx".
There are also some complicated rules about who the mail is comming from og
is sendt to.

I have searched around but have not found any VBA code exambles showing, how
to evaluate a mail to decide whether the mail should be included in the
search folder or not.

Can any of You help me with some code og link to some?

Ebbe
 
K

Ken Slovak - [MVP - Outlook]

The Web site www.outlookcode.com in general is an excellent resource.

Here's a tip on how to get the SQL/DASL syntax you need for something like a
search folder. Open the Customize Current View dialog and click the Filter
button. Set up a filter on the Advanced tab and after you add it the search
criteria for the filter look at the SQL tab.

For something like begins with or ends with you use the LIKE operator with
the "?" wildcard. So begins with "test" would look like this:

"urn:schemas:httpmail:subject" LIKE 'test%'

For ends with "test" it would look like this:

"urn:schemas:httpmail:subject" LIKE '%test'

For contains "test":

"urn:schemas:httpmail:subject" LIKE '%test%'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top