This project has moved and is read-only. For the latest updates, please go here.

Visual Studio Outlook Project References

Jan 19 at 10:06 PM
Edited Jan 19 at 11:18 PM

I am trying to develop a simple outlook project to get some basic knowledge on how NetOffice is used. I am using in the Visual Studio Community IDE. I have Office 365 installed. I have created references to the NetOffice.dll, OutlookAPI.dll, OfficeAPI and VBIDEApi.dll. I have not referenced the Outlook 16 object library (Office 365). My code, which was copied from one of the examples is:

Imports NetOffice.OutlookApi
Imports NetOffice.OutlookApi.Enums

Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    ' send mail in outlook
    ' taken from Example03.vb
    ' start outlook
    Dim outlookApplication = New Outlook.Application()

    ' Create a new MailItem.
    Dim mailItem As Outlook.MailItem = outlookApplication.CreateItem(OlItemType.olMailItem)

    ' prepare item and send
    mailItem.Subject = "hello eric"
    mailItem.Body = "Season Greetings from NetOffice. Kind Regards - Sebastian"

    ' close outlook and dispose

End Sub
End Class

The issue that I have is that is that types Outlook.Application() and Outlook.MailItem are not defined. I can fix that by adding a reference to the Outlook 16 object library and Importing Microsoft.Office.Interop but my understanding was that this is not supposed to be required. Is that correct? It appears that I have missed something. If anyone can point me in the right direction it would be appreciated.

Jan 21 at 2:26 AM

Eventually I solved my issue by setting the Embed Interop Types property for the NetOffice references to false.

Jan 24 at 6:53 AM
You need set any NetOffice reference option "Embed Interop Types" to false.

Visual Studio do a mistake here and set this option true by default because NetOffice assemblies mask himself as an PIA Interop Assembly.