Get body and subject from .msg file saved in a directory

So I have a ton undeliverable messages that come into my email box weekly. For some reason instead of having a normal body, the system doing the auto-reply put the actual response in an attachment as a .msg file. I have saved the .msg files, about 200, to a folder on my C: drive. How can I get the body and subject of each of these .msg files so I can parse through them? So far I have retrieved the file paths of each file in a list using directory.GetFiles(), but I’m having trouble replicating what the ‘get mail messages’ activity does with these .msg files.

Is there a way to move the .msg files from the C: to an inbox folder on my email? At that point the messages are just regular outlook messages and I can use another workflow I’ve made to go through mail messages.

Do you want the robot to do it? You can manually drag + drop the files from windows explorer into the folder of your choice within outlook if you’re doing it manually.

Otherwise I think you’ll need to use an outlook macro (using VBA) - I don’t think there’s a way to do it with vb.net/uipath

This is the way i’ll have to do it if I can’t figure out how to get the message body and subject from the files on the C: drive. I would really like the bot to just go look at the saved attachments because the end goal is to have this process unattended.

If you’re doing it all unattended, I’d probably just use a macro to do so. This link is a macro that opens a .msg file and saves all attachments. You can re-use it with a couple edits to instead forward the email to whoever you want. Read a .msg file and save attachement - #2 by vvaidya

For each file (of type string) in directory.getfiles(YourFolderPath,*.msg)
Start Process (run .vbs file shared in link above)
Delete file
Next file

I actually tried this already. errors out on the CreateObject(“Outlook.Application”). I looked into that error, but started looking for other ways options. Also the .msg is the attachment.