Read a .msg file and save attachement


#1

I have an email file on the desktop (a .msg file extension). How do I read it and save the attachment like you can do with the Outlook method?.


'Outlook.MailItem' is not defined. Invoke code problem
#2

This simple vbs should work fine, you could even pass the arguments in the Start Process activity.

Dim OlApp
Dim Eml
Dim Arg
Set Arg = WScript.Arguments
Dim File

File = Arg(0)

Set OlApp = CreateObject(“Outlook.Application”)
Set Eml = OlApp.CreateItemFromTemplate(File)
Download(Eml)

Sub Download(objEml)
For Each Attch In objEml.Attachments
Attch.SaveAsFile "C:\temp\" & Attch.FileName
Next
End Sub


How to access the attachments from attachments objects that are .msg type of object and are emails themselves?
Retrieving attachments from saved email (.eml)
How to read mail messages saved in a folder in explorer (a .msg file) as uipath mail objects
How to get attachments from mail messages already downloaded in folders
Call vbs in UIpath
Outlook fields extract
Sending mail through .eml file in Outlook email
Read .msg file
#3

This worked. Thank you! I’m not very experienced with Visual Basic or C# so this was great.


#4

Sorry I’m not familiar with Visual Basics. What if your file name has a lot of spaces. For example, examine this file.msg


#5

Hey

Sorry for being a bit of an idiot but what is Dim? I’m completely stumped and any help would be greatly appreciated

Thanks!


#6

This answer from web may help you understand DIM

Dim originally (in BASIC) stood for Dimension, as it was used to define the dimensions of an array.

(The original implementation of BASIC was Dartmouth BASIC, which descended from FORTRAN, where DIMENSION is spelled out.)

Nowadays, Dim is used to define any variable, not just arrays, so its meaning is not intuitive anymore.


#7

i am getting vbscript compilation error. is there some settings to be enabled.


#9

I am trying to see if there is any possibility to get the ‘Eml’ object in UI Path. Please can you help?


#10

I remember reading somewhere about DIM as short for Declare In Memory? Was that wrong?


#11

Hello, Can You please make yourself more clear. i do not understand, this since I am a beginner at uipath.
Thanks a lot much appreciated.


#12

Hi vvaidya,

Is there a way to check for saved .msg file for certain content like “Approved” ?

Many Thanks,
Tabrez