Get Outlook Mail Messages: Condition is not valid (SQL Subject Filter Query)

I was trying to filter Outlook email with specific sender and subject contains specific phrase “ROC Fraud Mana”. However there was an error saying that “Condition is not valid”. My filter string is as below:

“[senderemailaddress]='”+str_SenderEmail+“’ AND @SQL=”“http://schemas.microsoft.com/mapi/proptag/0x0037001f”" LIKE ‘%ROC%’ AND @SQL=““http://schemas.microsoft.com/mapi/proptag/0x0037001f”” LIKE ‘%Fraud%’"

Where did I do wrong? Please help!

1 Like

@s3342050 Hope this Link helps you

I tried the solution mentioned in that topic and the result shown as above :frowning:

Hi @s3342050

Have a view on the thread!

Try changing the second AND to OR and give a try!

Regards

Hi @s3342050

Yours looks correct, very often it is the single and double quotes that are of the wrong format. Please could you try this and see if it works? Or try replacing all single and double quotes in Studio.
"[SenderEmailAddress]='"+str_SenderEmail+"' AND @SQL=""http://schemas.microsoft.com/mapi/proptag/0x0037001f"" LIKE '%ROC%' AND @SQL=""http://schemas.microsoft.com/mapi/proptag/0x0037001f"" LIKE '%Fraud%'"

I’ve tried your solution but it didn’t work :frowning:

I’ve tried your solution but it didn’t work…

Try this. I had this same issue and this code seems to work.

“@SQL= (urn:schemas:httpmail:fromemail LIKE '”+str_SenderEmail+“’ and urn:schemas:httpmail:subject LIKE '%ROC%’ and urn:schemas:httpmail:subject LIKE '%Fraud%’)”