rameezimtiaz
(Muhammad Rameez Imtiaz)
January 7, 2023, 2:54pm
1
Hi,
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
Anil_G
(Anil Gorthi)
January 7, 2023, 3:34pm
4
@rameezimtiaz
Instead of equals try with like…may be it contains some more characters as well
"@SQL=urn:schemas:httpmail:subject LIKE '%" + subject + "%'"
cheers
rameezimtiaz
(Muhammad Rameez Imtiaz)
January 7, 2023, 5:52pm
5
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?
rameezimtiaz
(Muhammad Rameez Imtiaz)
January 7, 2023, 6:00pm
6
I have tried the following way as well
“@SQL=urn:schemas:httpmail:subject LIKE '%”+subjectTitle+“%'” and “@SQL=urn:schemas:httpmail:SenderEmailAddress LIKE '%”+sender+“%'”
1 Like
Anil_G
(Anil Gorthi)
January 7, 2023, 6:07pm
7
@rameezimtiaz
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
Cheers
Cheers
rameezimtiaz
(Muhammad Rameez Imtiaz)
January 7, 2023, 6:11pm
8
This worked
“[Subject] = '”+subjectTitle+“’ AND [SenderEmailAddress] = '”+sender+“'”
2 Likes
rameezimtiaz
(Muhammad Rameez Imtiaz)
January 7, 2023, 6:42pm
9
is there any way to add attachment name filter as well?
@Anil_G
Anil_G
(Anil Gorthi)
January 7, 2023, 7:30pm
10
@rameezimtiaz
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
Hi @phoenix123
Usually in Get outlook mail activity we can check only a mail HAS attachment or not
we cannot filter based on the file in the attachment
So we need to get the mail message list and then only we can check with the attachment has a file of type we need or not
these are the steps to be followed to get this done
Use get outlook mail activity and get all the mails you want with a variable of type mailmessage collections and name it as out_mailmessage
Use a for each loop and pass…
Cheers
system
(system)
Closed
January 10, 2023, 7:31pm
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.