Create Appointment in Outlook using VB.NET

Outlook provides a number of objects and methods for taking advantage of its built-in capabilities.This article show  how to create an appointment in Outlook by using the Outlook Object Model in Visual Basic .NET.

Appointments are activities that you schedule in your calendar that do not involve inviting other people or reserving resources.Appointments are shown in the calendar in time slots corresponding to start and end times as shown below.

Dim
TempApp As Outlook.Application = New Outlook.Application()

'An AppointmentItem 'TempAppItem' object represent one appointment              
Dim TempAppItem As Outlook.AppointmentItem = TempApp.CreateItem(Outlook.OlItemType.olAppointmentItem)

 

TempAppItem.Subject = "Create Outlook Appointment Item with VB.NET"

TempAppItem.Body = "We can create appointment with the help of vb.net"

'Set Location

TempAppItem.Location = "No Location"

 

'Set start  date and times

TempAppItem.Start = Convert.ToDateTime("11/08/2009 10:00:00 AM")

 

'Set  end date and times

TempAppItem.End = Convert.ToDateTime("11/08/2009 11:00:00 AM")

 

'set the Reminder box if you want Outlook to remind you the appointment is coming up.

TempAppItem.ReminderSet = True

TempAppItem.ReminderMinutesBeforeStart = 5

  

'we can choose how the time is categorized (Busy, Tentative, Free, and so on)

TempAppItem.BusyStatus = Outlook.OlBusyStatus.olBusy

 

TempAppItem.IsOnlineMeeting = False

 

' Save to Calendar.

TempAppItem.Save()

 

TempApp = Nothing

TempAppItem = Nothing  

Note: The most improtant point here to performing all tasks is to add a reference to "Microsoft Outlook object library", In case of

  • Microsoft Outlook 2000 - Add "Microsoft Outlook 9.0 object library"
  • Microsoft Outlook 2002 - Add "Microsoft Outlook 10.0 object library"
  • Microsoft Outlook 2003 - Add "Microsoft Outlook 11.0 object library"
  • Microsoft Outlook 2007 - Add "Microsoft Outlook 12.0 object library"


Similar Articles