First permutation of the project
Update on my project

Documentation can be SO irritating!

I decided I wanted to do the regular Windows to Outlook side of the project first.  It makes sense having both, as I often change my sets in the morning, in front of my desktop computers.

 

So I wanted to figure out how to create an Outlook item.  I started with this article:

 

http://support.microsoft.com/kb/313787

 

Lovely article but I couldn't get it to compile.  I started doing research on the error message and kept running into references to PIA's.  I found them, and I had to install them.

 

http://www.microsoft.com/downloads/thankyou.aspx?familyId=59daebaa-bed4-4282-a28c-b864d8bfa513&displayLang=en

 

I also found this article which was helpful too:

 

http://msdn.microsoft.com/en-us/library/bb226711.aspx#officeoutlook2007whatsnewdeveloperspart1__intro

 

So here is what I had to do to create an Outlook Calendar entry (which does work).

 

I had to add an reference to the PIAs:

 

Add a reference to the PIAs. To do this, follow these steps:

a. On the Project menu, click Add Reference.
b. Click the NET tab, locate Microsoft.Outlook.Interop.Outlook, and then click Select.
c. In the Add References dialog box, click OK

 

The next thing I had to do was to add the following statement to the top of the program:

 

It now looks like:

 

Imports System.Reflection
Imports outlook = Microsoft.Office.Interop.Outlook

 

Module Module1

 

Sub Main()
' Create an Outlook application.
Dim oApp As Outlook.Application = New Outlook.Application()

 

' Get NameSpace and Logon.
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi")
oNS.Logon("YourValidProfile", Missing.Value, False, True) ' TODO:

 

' Create a new AppointmentItem.
Dim oAppt As Outlook.AppointmentItem = oApp.CreateItem(Outlook.OlItemType.olAppointmentItem)
'oAppt.Display(true) 'Modal

 

' Set some common properties.
oAppt.Subject = "Created using OOM in C#"
oAppt.Body = "Hello World"
oAppt.Location = "Samm E"

 

oAppt.Start = Convert.ToDateTime("11/30/2001 9:00:00 AM")
oAppt.End = Convert.ToDateTime("11/30/2001 1:00:00 PM")

 

oAppt.ReminderSet = True
oAppt.ReminderMinutesBeforeStart = 5
oAppt.BusyStatus = Outlook.OlBusyStatus.olBusy ' olBusy
oAppt.IsOnlineMeeting = False

 

' Save to Calendar.
oAppt.Save()

 

' Display.
'oAppt.Display(true)

 

' Logoff.
oNS.Logoff()

 

' Clean up.
oApp = Nothing
oNS = Nothing
oAppt = Nothing
End Sub

 

End Module