Filter Outlook Mail with Subject that Starts with Specific word/ letter

Hi All.

I’m trying to filter outlook email by Subject that starts with IPO example ‘IPO1234’ since there is single quote present in subject already, I’m quite not sure how to make this work.

I tried with

[Subject]= ‘IPO1234’”

Also tried to use variable:

“[Subject]= ”+strVar+“”

With same value inside. But didn’t work.

The first 3 letter of subject remain same i.e., IPO , so is it possible to filter email that stars with specific letters?

Please note that subject already contains ‘ ‘ (single quotation) marks in the prefix and suffix

Any help is appreciated.

Thank you In advance.

have a look here for filters (get outlook message)

Give a try:
"@SQL=""urn:schemas:httpmail:subject"" like '''IPO1234''%'"
we do escape the ’ with an additional ’ within the email filter expression

Thank you so much @ppr I’ll give a try and let you know.

Mails_List.Where(Function(M) M.Subject.Tostring.Contains(“IPO”))

2 Likes

Hi @ppr it did not work. Says cannot parse condition. Please help me how can i use variable with this.

What you shared is static.

Also very confused with Quotation marks.

please share with us on what you have implemented so far e.g. by some screenshots

Sure. I wanted to replace “IPO418586” with variable.

You mentioned that the search term has quotes ‘IPO418586’
The filterexpression needs to surround the searchterm with quotes
When quotes are part of searchterm then we escape it with an aditional quote

thats why following was mentioned above

did you already tried it?
Keep in mind also that % will wildcarding it

make the code bit dynamic, add like ‘Asterisk and IPO and Asterisk’, it will pull the all emails which contains IPO.

“SQL=urn:schemas:httpmail:subject LIKE '%”+variable+“%'”