AdvancedSearch on a substring of a mail subject field

  • Thread starter Thread starter Andrew Lockwood
  • Start date 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
 
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
 
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
-
 
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
 
Back
Top