Email filter Based on the Attachment content values

My mail box contains 5000+ emails and criteria to filter the email is:

  1. Any values from an excel will be available in pdf which has been attached to that email

I tried giving filter as

Sometimes its working as expected, but sometimes even though it contains only one email in my mail box its returning me all emails with attachments.

Is there any other way to filter out these emails other than looping each email in whole mail box?

Hi @Divyashreem
Just to confirm one thing around

Do u need to check whether the excel value is present within pdf data which is attached to mail right ?


Hi @Divyashreem

First filter the emails with attachments only [ specifically with pdf] using below linq query

mails_list.AsEnumerable().Where(Function(mail) mail.Attachments.Where(Function(file) file.Name.Contains(“pdf”)).Count>0).ToArray where mail_list is the list of mails obtained from get outlook mails or other

Now use for each loop to loop through each mail

Inside it make the sequnce in such a way as to read the attachment using pdf activities and validate it by whether excel data is present in it or not.

Nived N

I do not want to use Looping Since most of the emails in that mail box will contain pdf attachment, and reading and looping 5000+ emails would be more time taken, is there any other way to handle this?

But i think there would be a need of looping since u had to check whether the pdf data contains this value or not so definelty we need to loop through each of it