Hi all,
Ok, so the code below (in VB.NET - wanted C#.NET instead but what can you do?) automatically creates a meeting appointment in Outlook Calendar. It does exactly what I want. My next question is how do I delete an appointment in Outlook Calendar? Searched the net and cant find a result.
Imports System.Reflection
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(USERNAME, PASSWORD, 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("10/10/2008 9:00:00 AM")
oAppt.End = Convert.ToDateTime("10/10/2008 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