Cannot save attachments from Outlook mail

I have tried to create a simple process to search one unread mail from Outlook 2019 inbox, and save attachments to a folder.

However, Get Outlook wants to save mails to a Collection of Mails.
When I use “For each” command to the collection and use function “Save attachments”, I get the following error message:

“Object reference not set to an instance of an object.”


sMail1 's type is MailMessage. I don’t know how to convert collection of mails to a one mailmessage.


In SaveAttachments, you have to give mail not sMail1

Try that

Hope this helps you


1 Like

If you want to take just 1 mail, sMail(0) will be the first mail
Put sMail(0) in Save Attachments without using For Each

hi @alerpa

please check the for each type argument : System.Net.Mail.MailMessage

Please find the attached xaml for your reference.
Outlook_MailAttachment.xaml (15.2 KB)