Need to add multiple filters in get outlook messages

Hi Everyone,

My requirement is I need to add 3 filters in get outlook mail message activity

  1. based on subject name eg: Generated Reports
    2.based on from address eg: xyz@gmail.com
    3.based on date i.e., 20th of that month eg: 20th of may

please let me know your suggestions
Thanks in advance

Hello @kavya.s16 ,

Refer to the below post. It will solve your issue.

instead of today if i need to search for a particulart date how can i do it?
@Rahul_Unnikrishnan
@Palaniyappan could u pls help

Hello @kavya.s16 ,

You can try as below. This will help to filter the email based on date and time.

**CDate(item.Headers(“Date”)) >= Datetime.ParseExact((“05/06/2022 00:00:00”).ToString.SubString(0,10),”MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture) **
AND
CDate(item.Headers(“Date”)) <= Datetime.ParseExact((“05/26/2022 24:00:00”).ToString.SubString(0,10),”MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture)

I tried using this to filter outlook mails
“@SQL=urn:schemas:httpmail:subject like ‘%SV%’ AND urn:schemas:httpmail:from=‘xxxxx@xxxxx.com’”

but the from email address doesn’t seem working , i have to apply 3 filters 1.subject 2.from address 3 date 20 th of current month

@Rahul_Unnikrishnan @Palaniyappan any solution for this ?

try this @kavya.s16
"[Subject] = 'Generated Reports' AND [SenderEmailAddress] = 'xyz@gmail.com' AND [Received] >= '" + Now.toString("20/MM/yyyy") + " 00:00AM' AND [Received] < '" + Now.toString("21/MM/yyyy") + " 00:00AM'"

Hi @jack.chan i cant use the [subject] for subject bcoz subject line might vary eg : FW : Generate reports then it wont work

then try this please @kavya.s16

"@SQL=urn:schemas:httpmail:subject like '%Generated Reports%' AND urn:schemas:httpmail:fromemail = 'xyz@gmail.com' AND urn:schemas:httpmail:datereceived >= '" + Now.ToUniversalTime.toString("20/MM/yyyy 00:00:00") + "' AND urn:schemas:httpmail:datereceived < '" + Now.ToUniversalTime.toString("20/MM/yyyy 00:00:00") + "'"

1 Like

@jack.chan how to use variable instead of generated reports in the subject and that from address part is not working

"@SQL=urn:schemas:httpmail:subject like '%"+variableSubject+"%' AND urn:schemas:httpmail:fromemail = '"+variableEmail+"' AND urn:schemas:httpmail:datereceived >= '" + Now.ToUniversalTime.toString("20/MM/yyyy 00:00:00") + "' AND urn:schemas:httpmail:datereceived < '" + Now.ToUniversalTime.toString("20/MM/yyyy 00:00:00") + "'"

@jack.chan fromemail is not working and date part is working only if first part is used but mails from 20th is also read
“@SQL=urn:schemas:httpmail:datereceived >= '” + Now.ToUniversalTime.toString(“MM/19/yyyy 00:00:00”) + “'”