Applying filters in Get Outlook Messages

My use case was to try and filter Outlook mail messages based on senders email domain. The filter should be able to filter all the following mails ‘abc@xyz.com ; sdf@xyz.com; wde@xyz.com’ etc. The set users who send mails are not defined.

I did not want to iterate each mail in for loop to use mailmessage.from and was particular to use the filter option in the ‘Get MailMessages’ activity. I had a tough tiome finding the solution and wanted to share with you all the same.

Solution:

Use DASL query in the filter field. Most of the links in web will only give you option to filter the subject. Here is the only link that gave me other options that I could use in the query.

Finally my query looked like this :slightly_smiling_face:
@SQL”+Chr(34)+“urn:schemas:httpmail:fromemail”+Chr(34)+“like ‘%xyz.com%’”

6 Likes

Hi @Pavithra
Thanks for this. Any idea on how to club multiple columns to pass to Mail filters? I used the below string to pass and it’s failing:
strMailFilter=“@SQL=urn:schemas:httpmail:subject LIKE '%”+strSubject.ToString+“%’ AND urn:schemas:httpmail:fromemail LIKE '%”+strSender.ToString+“%’ AND urn:schemas:httpmail:datereceived LIKE '%”+strtimestamp.ToString+“%'”