Creating a search folder using VBA

  • Thread starter Thread starter Ebbe
  • Start date Start date
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
 
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%'
 
Back
Top