This question has been asked many items, but I wasn't able to find appropriate actual solution.
I am developing WPF app using .Net Core 3.1 and need to open Outlook (365, 16.0.12827.20328) window with new email and attachments. The easiest way is using Interop.
My code:
Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application();
MailItem oMsg = (MailItem)oApp.CreateItem(OlItemType.olMailItem);
oMsg.Subject = "subject";
oMsg.BodyFormat = OlBodyFormat.olFormatHTML;
oMsg.HTMLBody = "body";
oMsg.Attachments.Add("filepath", OlAttachmentType.olByValue, Type.Missing, Type.Missing);
For this I need Interop package. I tried installing nuget Microsoft.Office.Interop.Outlook and adding reference COM -> Interop.Microsoft.Office.Interop.Outlook.
In both scenarios I get error: System.IO.FileNotFoundException: 'Could not load file or assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. The system cannot find the file specified.'
What do I have to do to solve the issue? And why I need version 15.0.0.0? Internet says that version 15 is for Outlook 2013.