Outlook AdvancedSearch CONTAINS / LIKE

Giganews Newsgroups
Subject:Outlook AdvancedSearch CONTAINS / LIKE
Posted by: Andrew Lockwood (andr…@lockwoods.me.uk)
Date:Sun, 5 Oct 2008

Can anyone show me how to construct an AdvancedSearch filter to search on a
substring of the subject field.  In VBA, the construct is

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

but I cannot construct a string in Delphi that works.

'urn:schemas:httpmail:subject = ' + QuotedStr('TheWholeString') works if I
know the whole string, but neither

'urn:schemas:httpmail:subject LIKE ' + QuotedStr('%' + 'SubString' + '%')

nor

'urn:schemas:httpmail:subject LIKE %' + QuotedStr('SubString') + '%'

work for a substring.

Any help would be most gratefully received.

Andrew Lockwood

Replies