I want to use Invoke Code to read a local .msg file to get an attached file.
Dim OL As New Microsoft.Office.Interop.Outlook.Application
Dim Msg As Outlook.MailItem
Msg = OL.CreateItemFromTemplate("C:\Users\az27355\Desktop\tempatt\original_email.eml.msg")
Console.WriteLine(Msg.Subject)
'TODO attached pdf = Msg.Attachment
First problem was to import Microsoft.Office.Interop.Outlook. I’ve seen others with similar issues and their solution only helped me partially.
The code failed at line 1 so I had to manually add to the xaml:
But the code still fails:
error BC30002: Type ‘Outlook.MailItem’ is not defined. At line 2