How download attachments from outlook files in a folder?

For example :
I want to open all the mail files in “Email” Folder and download all the attachments

have a look here:

Agree with ppr - when an attachment is against the email whilst in the email environment such as Outlook, the bot does not know what the attachment is until it is detached while in the environment and saved as an attachment. What you wish to be done should be done at the front of the process prior to the message being saved in a folder as a .msg folder. Perhaps re-approach your task and have the automation begin by reviewing all emails in the inbox, saving all attachments in a folder and then saving the email message as a .msg…just a thought.

1 Like

the files are in .msg format can i read it and download the attachments inside it?

You can but you cannot use the bot to open and extract the attachments AFTER the .msg file has been saved in a network folder. You need to remove the attachments at the beginning of the process when the bot is reading all of the emails. You will have to manually remove attachments on files saved as .msg files. I do not know of a way to have an automation do this because the bot does not recognize something as an attachment unless it is inside of a for each loop with a MailMessage or MailAttachment scope.

we shared a link for doing this. Did you try?

MicrosoftTeams-image (1)
this error is coming

Are you not able to manage the process with the bot actually processing the emails in the inbox? Your problem here is that when the email is detached from, let’s say Outlook for example, the email becomes a file with no specific attachment. Attachments are recognized within the get mail and Mail Message or Mail Attachment scopes. Another issue is that when you try to open the email in code from the folder it is saved within, your bot may not have rights to interact with the email. For example, let’s say several users drop emails into this folder and have asked you to remove the attachments from them, the bot will open the emails in the program which interacts with them, again, let’s say Outlook. Your bot would then have to have rights to each of those email addresses where the emails were originally found or you will get the error message you get “…or you dont have permission to open it”.

Several options, does your bot have an email address with its own active directory credentials? If so, you can have those emails sent to your bot instead of stored in a network folder. If this is possible, you can code to have your bot process the attachments within its own email folder which it would have rights to, still store the message file to a network drive but also be able to save the attachments as needed. We have over 200 automations that do this type of activity.

If you need more help I am more than willing to have a Teams or Zoom call with you

i had found a solution using macro

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