Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Outlook Interop in .NET Core 3.0?

I migrated our project from .NET Framework to .NET Core 3.0 (C#, WPF) and now I can not use Microsoft.Office.Interop.Outlook anymore, because it is not compatible with .NET Core 3.0. What I want to achieve is opening/sending prefilled Outlook Emails.

Is there an alternative to this interop dll, or maybe a way to use .NET Framework for only this reference?

  • Microsoft.Office.Interop.Outlook
  • NetOffice.Outlook
like image 682
nitg Avatar asked Jun 04 '19 10:06

nitg


People also ask

How do I use Microsoft Office Interop Excel in .NET core?

Office. Interop. Excel' nuget package, and then add reference to 'Microsoft Excel 16.0 Object Library' (right click the project -> 'Add' -> 'Reference' -> search and add 'Microsoft Excel 16.0 Object Library' ). Click ''Interop.

Is Office Core a version of Office?

The Home and Business edition of Microsoft Office includes the flagship core products, Microsoft Word, PowerPoint, and Excel. It includes Outlook instead of OneNote, with the assumption that powerful email management and features is more important to the business owner than taking extensive notes.


2 Answers

This worked for me:

  1. Right click Dependencies and click "Add Reference"
  2. Select Microsoft Outlook 16.0 Object Library under the COM tab.
  3. Under Dependencies/COM in your project, select Interop.Microsoft.Office.Interop.Outlook reference, then under "Properties" set "Embed Interop Types" to "Yes"
  4. I also had to uninstall the Microsoft.Office.Interop.Outlook NuGet package because it caused a conflict with the reference in Dependencies/COM.

Outlook automation is now working fine.

like image 92
PAQ Avatar answered Sep 23 '22 23:09

PAQ


I am having the same issue when trying to use Microsoft.Office.Interop.Excel 15.0.4795.1000. It won't run when I target .net core 3.00 preview 7.

At this stage I do not think there is any other option than reverting back to .NEW Core 2.2.

like image 25
Yann Avatar answered Sep 24 '22 23:09

Yann