How to create more complex filter criteria in Get Outlook mail messages activity?

I am trying to get Outlook messages which makes two criteria’s simultaneously - they are from a specific sender, and their subject contains one of two possible texts. When I was trying to do it only for Subject with simple OR it’s working, but with adding FROM parameter I am getting error and I do not know what is causing it.

The systax I am using in filter is:

“[FROM] = " & MailSender.ToString & " AND ([SUBJECT] = '” & SubjectFirst.ToString & “’ or [SUBJECT] = '” & SubjectSecond.ToString & “’)”

And lets say that MailSender is = "abc@gmail.com" , SubjectFirst = “abc” , SubjectSecond = “def”

Can you please help me with it?

Consider using a DASL filter e.g.

“@SQL=(urn:schemas:httpmail:fromemail LIKE ‘abc@gmail.com’) AND (urn:schemas:httpmail:subject LIKE ‘abc’ OR urn:schemas:httpmail:subject LIKE ‘def’)”

It takes a bit of effort to get working but can potentially be very useful.

This blog gives a good starting point:
https://blogs.msdn.microsoft.com/andrewdelin/2005/05/10/doing-more-with-outlook-filter-and-sql-dasl-syntax/

1 Like