Count number of Excel files on outlook mail before save into local

Hi Everyone.

I have some emails contain number of the excel files inside.

How to count number of the excel files before save all of those excel files into the local.

Exp: The email has attached 5 excel files i want to return “5” before save them into local.

Thanks in advance!

mailmessage.attachments.count should return the number of attachments. You can loop the attachment to only find excel files.

Thanks you.

I have found solution
item.Attachments.Where(Function(x) x.Name.Contains(".pdf")).Count

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.