Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all articles
Browse latest Browse all 1741

New Post: Visual Studio Outlook Project References

$
0
0
Hi,

I am trying to develop a simple outlook project to get some basic knowledge on how NetOffice is used. I am using vb.net in the Visual Studio Community IDE. I have created references to the NetOffice.dll, OutlookAPI.dll, OfficeAPI and VBIDEApi.dll. 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.Recipients.Add("xx@xx.com")
    mailItem.Subject = "hello eric"
    mailItem.Body = "Season Greetings from NetOffice. Kind Regards - Sebastian"
    mailItem.Send()

    ' close outlook and dispose
    outlookApplication.Quit()
    outlookApplication.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 Importing Microsoft.Office.Interop but my understanding was that this is not supposed to be required. It appears that I have missed something. If anyone can point me in the right direction it would be appreciated.

Thanks

Viewing all articles
Browse latest Browse all 1741

Latest Images

Trending Articles



Latest Images