Reading .msg files in Studio, importing outlook in VB

Hi, Im trying to read .msg files invoking VB code and have some trouble getting it to compile. Id appreciate some feedback on my code :slight_smile: Thank you for your help

image

EmailFilename is the filepath of the email given as an argument

Try using Imports Microsoft.Office.Interop.Outlook instead of what you’re using while importing
Also can you share your fulll code?

1 Like

Import the ‘Microsoft.Office.Interop.Outlook’ namespace using the Data Manager to resolve the compile-time error.

1 Like

Hey @idoia.fernandez,

Imports statements are not allowed inside Invoke Code, so remove that and add the Outlook namespace in Imports panel of UiPath. Create Outlook Application object before calling methods: Dim outlookApp As New Microsoft.Office.Interop.Outlook.Application. Then use Dim email = outlookApp.Session.OpenSharedItem(msgFilePath) to read the .msg file.

3 Likes

thank you so much! this worked. Would you also happen to know how to solve this?


image

Can you please create a separate topic dor this we will try to help you. Thank you

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