Count how many Excel attachements a MailMessage object has

Hello there,

I’m trying to count how many xlsx files are in a given AttachmentCollection. I’m trying to apply a filter using the CountOf function like so:

Thank you in advance

At least we can do.

With the help of Regex we can handle it more general for the different variations

Messages(0).Attachments.Where(Function (x) Regex.IsMatch(Path.GetExtension(x.Name).ToUpper,Pattern)).Count

Modify the Patterns as by your needs /choice
Use mail instead of Messages(0) in your code

Ensure following:


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