cancel
Showing results for 
Search instead for 
Did you mean: 

Convert msg file to Text file

Ashis_KumarRay
Level 4
​​I have a requirement where process should read .msg file which saved in a shared folder not in Outlook. I found there is no straight forward VBO exist to read the data from msg file. So what I am trying to do is, I will convert the .msg file into Text file and then Process can read the text file. So converting from msg file to text file, can anybody help me to provide any macro if you guys have developed similarly. Or Any alternative way is there to read all data from .msg file directly through our VBOs which I am missing completely. I have developed a macro (Mentioned below) but while converting Outlook is throwing a security warning message on the screen where we have to press allow button to complete the macro step. I don't know how to disable that Outlook warning pop up through macro. Please help me if anybody have any solution for this.

    Dim OL As Object

    Set OL = CreateObject("Outlook.Application")
    Dim Msg

    Set Msg = OL.CreateItemFromTemplate("C:\Temp\RE MT399 - URO979368CC.msg")
    Msg.SaveAs "C:\Temp\test.txt", olTXT



------------------------------
Ashis Kumar Ray
RPA Developer
TCS
Europe/London
------------------------------
9 REPLIES 9

Have you tried the Get Received Items actions in MS Outlook Email VBO? The output this action will give you a collection containing various attributes, one of which is the email body. Check out the Business Object Definition for more info.

Regards,
Pratyush

------------------------------
Pratyush Garikapati
ROM Architect
Blue Prism
Asia/Kolkata
------------------------------

​Hi Pratyush,

I have checked the object "MS Outlook VBO" where I didn't find any action called "Get Received Items". Are you using anything different VBO? Could you please share the VBO with me? Also we don't prefer using MS Outlook VBO to communicate Outlook because a Outlook security warning pop up always appears on the screen while using any action of this object. Also neither we have access to disable the Trust centre option nor IT infrastructure team are interested to do.

Please let me know your comments on this.

Thanks
Ashis

------------------------------
Ashis Kumar Ray
RPA Developer
TCS
Europe/London
------------------------------

You probably are using MS Outlook VBO from a prior version or from one of our TAP partners. Download the Blue Prism provided VBO from here - https://digitalexchange.blueprism.com/dx/entry/9648/solution/ms-outlookvblue-prism-utility

Check if this is working for you.

Regards,
Pratyush

------------------------------
Pratyush Garikapati
ROM Architect
Blue Prism
Asia/Kolkata
------------------------------

..or use the one attached here for BP 6.4 and above

------------------------------
Pratyush Garikapati
ROM Architect
Blue Prism
Asia/Kolkata
------------------------------

Thanks Pratyush for the file.

While using this object I am getting same Outlook pop up ​warning message on the screen where we have to click allow button to proceed further. Do you use anything to avoid the warning pop up?

Also my requirement is to read the email from a normal shared drive folder not from Outlook folder under inbox so in this case how we can use the action "Get Received Items" as I didn't get anything out of this. Do you have any example for this?

------------------------------
Ashis Kumar Ray
RPA Developer
TCS
Europe/London
------------------------------

I misread your original query. You are right - Get Received Items will work only for emails in Outlook mailbox but will not work for emails saved in locally. You will have to extend the VBO (i.e. create copy -> modify the required code stages in the actions) to read *.msg files from file system.

Easier alternative is to keep the emails in Outlook and read them directly from there. I am assuming someone is saving these emails in a local folder. If they can instead move these emails to a sub-folder within the Outlook Inbox, then you can use Get Received Items to retrieve the emails from this sub-folder.

Can you send a screenshot of the Outlook pop-up warning?

------------------------------
Pratyush Garikapati
ROM Architect
Blue Prism
Asia/Kolkata
------------------------------

Attached the Pop-up warning.

We can't disable or enable anything from Outlook as we don't have access and IT team is not interested to give us the access.

Please let me know how we can avoid this by writing any code stage.

Thanks
Ashis

------------------------------
Ashis Kumar Ray
RPA Developer
TCS
Europe/London
------------------------------

Hello, Ashis!

Outlook has a default option that prevents third party scripts from accessing it when the antivirus is disable or needs to be updated.
The best work arround to avoid this from happening again is to go to File >> Options >> Confiabilty Central >> Programming access (My outlook is in portuguese, so it might be a bit different for you). On this window select the Never notify option. 
See the attached printscreen for some visual help.

Hope it helps!
Cheers





------------------------------
Diogo Furlan
Analyst
Grupo NC
America/Sao_Paulo
------------------------------

Hi Diogo,

But the issue is, we don't have access to enable that option. I have already checked this option in Google and in blue prism portal as well.

Also IT Infra team ​won't do as this is beyond company policy. Only option is to through Macro.

Regards
Ashis

------------------------------
Ashis Kumar Ray
RPA Developer
TCS
Europe/London
------------------------------