AdvancedSearch on a substring of a mail subject field

  • Thread starter Andrew Lockwood
  • Start date
A

Andrew Lockwood

I am trying to create a COM AddIn in Delphi, and I want to use the
AdvancedSearch functionality of Outlook.

If I am searching on the whole field, the following code works correctly

'urn:schemas:httpmail:subject = ' + QuotedStr(MyString)

From Outlook, I have determined that to search on a substring, the code in
VBA would be

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

However, I have been unable to translate this successfully into Delphi. Can
anyone help?


Andrew Lockwood
 
A

Andrew Lockwood

Thanks - but it doesn't work!

It doesn't cause a crash like some of the options I have tried, so
presumably this means that the filter is formatted in an acceptable way, but
the search takes quite a long time and returns nothing! Whereas if I create
a SearchFolder within Outlook using the same substring, it works perfectly
and takes about 1 second!


Andrew Lockwood
 
D

Dmitry Streblechenko

Are you sure you are searching in the right place?
Save the search (AdvancedSearch.Save - that will create a search folder) and
look at it with OutlookSpy (click IMsgStore button, select
PR_FINDER_ENTRYID, right click, select IMAPISession::OpenEntry, in the
IMAPIFolder window go to the GetHierarchyTable tab, open the new search
folder, in the new IMAPIFolder window go to the GetSearchCriteriaTab. What
do you see?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
A

Andrew Lockwood

Thanks - I got it working in the end. However, I changed so many things in
the attempt, that I do not actually know where the problem was.

Andrew Lockwood
 

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