Get Outlook messages filter by email

Hello, is it possible to only get messages sent from certain email address? I tried using filter
“[From]=‘certain@email.com’” but it works only when I type sender’s name and not email address.

Hello,

This is what I have that may help you.
(From m in mailmsg where (m.Subject = “text”)).ToArray()
(From m in mailmsg where (m.Subject.Contains(filterString))).ToArray()
(From m in mailmsg where (m.From.DisplayName.Contains(“fromname”))).ToArray()

You can change the .Subject or .From to .From.Address (or whatever the syntax is on that) for what you need.

The examples above create an array of messages from within your “mailmsg” list you retrieved and stored to a variable from Outlook or Exchange.

Thanks!

1 Like

Try [senderemailaddress] = ‘certain@email.com’ "

1 Like

Hello cristian,

I tried your solution but it was not working. Can you help me to using [senderemailaddress] in properties window of Get outlook mail messages to filter list email by email address?

Thanks and Regards!

Same here. The [SenderEmailAdress] condition just doesn’t seem to be working at all.

You need a double quotation (") before Christians string. Check this video for a full tutorial, How to filter Outlook messages by sender email address in UiPath - Full Tutorial - YouTube

Is this a LINQ query , Please share sample workflow to understand this

hey @Sakshi_Jain
I see that’s from 2017, while it does work. Ya, it is a vb.net LINQ, which you can use in an Assign activity to assign the result to an Array of MailMessage type, or directly in a ForEach. The assign activity would just be right after you use a Get Outlook Email or Get Exchange Email activity.

However, I don’t necessarily recommend using this unless you need to process specific emails in groups. For example, you have 100 emails, and you want to loop over half with one subject and then also do the other half with a different subject, so you would process all 100.

What I do recommend, though, is that you use the Filter property of your Get Outlook/Exchange Mail activity. If you don’t use the Filter, getting the mailmessages takes a super long time. For example, if you only need the emails FROM a certain person and 5 of the 100 would be pulled, it would cut your wait time down 1/20th the speed (ya, that’s a big time saver)

Here is a resource on how to use the Filter property:
https://forum.uipath.com/t/how-to-use-filter-property-of-getoutlookmailmessage-activity-to-filter-outlook-emails/307081

Regards.