How to filter outlook mail activity based on multiple parameters


I want to filter outlook email activity based on subject, sender email and attachment name. All these values are coming from a variable and I am using below code to filter but its not working. Please help in this regard.

“@SQL=urn:schemas:httpmail:subject = '”+subjectTitle+“'” and “urn:schemas:httpmail:SenderEmailAddress = '”+sender+"’


Can you try with fromemail instead of SenderEmailAddress? You can refer the below link on how multiple conditions can be used in DASL queries - UiPath Tutorial Day 72 : How to Filter Outlook Mail Message(DASL Query) Part 2 | Email Automation - YouTube


Instead of equals try with like…may be it contains some more characters as well

"@SQL=urn:schemas:httpmail:subject LIKE '%" + subject + "%'"


I have tried the following and got the attached error:

“@SQL=urn:schemas:httpmail:subject LIKE '%” + subjectTitle + “%’ and =urn:schemas:httpmail:SenderEmailAddress LIKE '%” + sender + “%'”


Can you make the expression for 2 variable and send?

I have tried the following way as well

“@SQL=urn:schemas:httpmail:subject LIKE '%”+subjectTitle+“%'” and “@SQL=urn:schemas:httpmail:SenderEmailAddress LIKE '%”+sender+“%'”


Please try this

"@SQL=urn:schemas:httpmail:subject LIKE '%"+subjectTitle+"%' AND @SQL=urn:schemas:httpmail:fromemail = '"+sender+"'"

Make sure email id is correct…i would suggest first try with hardcoded values to check and then use your variable



This worked

“[Subject] = '”+subjectTitle+“’ AND [SenderEmailAddress] = '”+sender+“'”


is there any way to add attachment name filter as well?



On attachment name you cant directly apply filter …you have to loop through the mails and get it and filter accordingly…and there is correction if you want to use dasl query…what worked was a jet for you…you the correct one would be this

"@SQL=""urn:schemas:httpmail:subject"" LIKE '%"+subjectTitle+"%' AND @SQL=""urn:schemas:httpmail:fromemail"" = '"+sender+"'"

Happy coding

If at all you need detailed steps for name filter


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.