Filter Outlook mails by subject and date

Hi Everyone,

My requirement is i need to filter/read the mails with particular subject and particular date

Subject : RPA Reports (wildcard is required bcoz its not exact subject everytime)
Date : Should read the mails received only on 20th of that month

both subject and date should be passed as variables

@ppr @Yoichi @Palaniyappan any suggestions?

Thanks in advance

You can refer to the docu:
Filter examples Get Outlook Mail Messages

For constructing and inserting the variables we would recomment to use the
String.Format(“ABC {0}”, Var1) …

@ppr but i need to combine two condition subject and date in single filter

You can do this as you can combine both conditions with an AND

1 Like

not able to combine schema and normal filter condition
“@SQL= urn:schemas:httpmail:subject Like '%” + variableSubject + “%’ AND [ReceivedTime] >= '” + Now.ToUniversalTime.toString(“07/MM/yyyy 00:00:00”) + “'”

Read Lsa mails: Cannot parse condition. Error at “@SQL= urn:schemas:httpmail:subject Like …”.

Try following:

String.Format("@SQL=(""urn:schemas:httpmail:subject"" like '%{0}%') AND (""urn:schemas:httpmail:datereceived"" >= '{1}' ) AND (""urn:schemas:httpmail:datereceived"" < '{2}' )",VarFilter,varStartRange, varEndRange)

with following schema
varStartRange = “07/20/2022 00:00”

Which we also can produce by
YourDateTimeVar.toString(“MM/dd/yyyy 00:00”)