Filter an Outlook email in outlook that contains a specific word in the attachment


In Outlook I have to search through an email folder in shared mailbox containing close to 5000 emails along with new emails are stored every day. Every email have an xlsx attachment. I have to search for a term (number or String) in that dump of emails and find that email having that search term in the attachment. Manually if enter the search string in "search current mailbox bar " it takes 3-4 sec to give the email that has that string in the attachment.

How can I do that with Uipath with getoutlook mail activity? What should be the filter condition in Getoutlook mail activity. If i give just the string in the filter field it is throwing invalid condition.

I cant download each and every email attachment and loop through those thousands of excels to search for that string.

Thanks in advance
best regards

Create a rule in Outlook with Header contains “file name” move it to your custom folder, and for Get outlook mails Activities Input that folder name to read Emails.

its not the header. String that has to be searched in outlook mail folder will be received from a different input file. So string is not constant here. That dynamic string value has to be searched through 5000 odd emails and get that attachment from the email that has this string. Body of the email is not required here.

use Following in your ForEach, this would work only after pulling out emails. If filtering while fetching itself is something we need to look

mls-> your Get outlook mailmessage output
mls.AsEnumerable().Where(Function(msg) (msg.Attachments.AsEnumerable().Where(Function(str) str.Name.ToString.Contains("inputString")).ToArray().Count>0))