Getting attachment from Outlook item .msg file

When the input to the automation is a file which is of format - Outlook item with .msg extension. This has attachments in it. How to read the .msg file and fetch the attachments from it downloaded to the local.

Hi @Mahalakshmi

Check this out

1 - Read file .msg - #7 by pavithra_pavi
2 - Extract email information if its a file (.msg) - #5 by mail.aniruddh.m

If this helps!
Additionally try using VB/#C code to download the attachments

@Mahalakshmi

To achieve this, first save that .msg attachment mail using Save Attachments.
Then use Get Mail Message From File activity to read .msg attachment as Mail, then further save the attachment from this email.

I’d use Outlook or a library that can parse .msg files. In UiPath, the easiest way is usually using the Outlook activities or a .NET library like MsgReader to open the .msg and extract attachments.

Once opened, you can loop through the attachments collection and save each one to a local folder. That’s usually much easier than trying to treat the .msg as a normal file directly.

What I’d do in this situation is to get the list of emails (probably you’ll have a O365array), filter the email that you need, convert it from O365array to MailMessage (for this you can use DirectCast) and do a For each for the attachments on that email (The type in the for each would be System.net.mail.attachment)