How to filter attachments Get Mails (Outlook)

Hi everyone,
Is there a way to filter to save specific attachments from get Mails? I have some email with multiple attachments but I want to save ONLY the ones with “*.xlsx” extension.

I tryed this way but didn’t work.


You can use LINQ query to check for the item you want. but might be easier to simply use an "for each " on item.attachment, and then use the if clause to check if this is an item you want to save ?

NOT tested, so may need updating
assing to an attachment variable

Item.Attachments.Select(Of OpenRPA.Office.Activities.Attachment)( Function(x) x.FileName.Contains(".xlsx")).First()

if not null/Nothing then


In c# we can use ? to just ignore if null so could do this on one line, but I don’t think that exists in VB … So need an assign, and if and an assign inside the if for this

Thank you for your inputs - they have been incredibly helpful, and I truly appreciate!

ForEach with ArgumentType: OpenRPA.Office.Ativities.Attachment

1 Like

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