Email filtering 2 diferent subjects

I have a process in which I need to get the emails that have the subject “Request” and also those that have the subject “Update”. How do I filter them?

1 Like

Use can filter the subject using AND condition. By Putting Request AND Update and then filtering the data using above condition.

Regards
Naman Jain

Hi @Marisa_Ontiveros1

You can use Filter Condition in the Get Outlook Mail Messages

For Example

“[Subject] = 'Request AND [Subject] = ‘Update’”

@Marisa_Ontiveros1,

Use this as subject is going to be “Request” or “Update” not both at a time.

Set this as Filter property.

"[Subject] = 'subject1' OR [Subject] = 'subject2'"

Thanks,
Ashok :slight_smile:

It works thank you very much

Sorry, there is no error when putting this code in the activity properties. But when I run it doesn’t filter, it doesn’t work. Sorry

Hi @Marisa_Ontiveros1

Can you try the below

Regards,

Hi @Marisa_Ontiveros1 ,

You can read all mails & then filter out using below linq:-

filteredEmails = emailsList.Where(Function(email) email.Subject.Contains(“Request”) Or email.Subject.Contains(“Update”)).ToList()

FilteredEmails variable type will be same, as the output of get outlook mail message.

Thanks

Hi @Marisa_Ontiveros1,

→ Use Get Outlook Mail Messages activity in the properties panel provide the sufficient information like account,mailfolder,output etc.
→ Assign a variable "filter" and it’s value is MailMessages.Where(Function(mail) mail.Subject.ToLower.Contains(“request”) Or mail.Subject.ToLower.Contains(“update”)).ToList(). Variable type of filter is system.collection.generic.List<system.net.mail.mail message>. Here MailMessages is the output of Get Outlook Mail Messages activity.
->Use for each and provide an if condtion mail.Subject.Contains(“Request”) Or mail.Subject.Contains(“Update”)
→ Print the value
image

Thank you

Hi @Marisa_Ontiveros1,

Please confirm if the expected result is able to achieved or not?