ARTICLE

How to create Appointment in Outlook using VB.NET

Posted by Hirendra Sisodiya Articles | Office and VB.NET November 09, 2009
This article show how to create an appointment by using the Outlook 2003 Object Model in Visual Basic .NET.
 
Reader Level:

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"

Login to add your contents and source code to this article
share this article :
post comment
 

Is it possible to push an appointment item into another user's Outlook Folder location? If not, is it possible to email appointment notifications to other people, and if so what is the procedure? Thank you very much.

Posted by tk gardner Feb 09, 2011

i think it is related to missing some assembly reference may be outlook interop..please check this....and let me know thanks

Posted by Hirendra Sisodiya Feb 03, 2011

Thanks!!! That was an Excellent post!!! But When I implemented it I go this error.... Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005. I tried researching about it and tried to give permission to aspnet users, tried looking for a DCOM object but couldnt find one for outlook. Can you suggest a solution? Thanks, Som

Posted by Somanath Pilla Feb 02, 2011

I have used code very similar to this to create a task in Outlook 2007, but I can't work out how to add a hyperlink into the body text to an executable.  I've tried using something like <outlook://  "c:\windows\notepad.exe">, but this is just added to the body text as text.  Any clues on how to add a hyperlink into the body text would be appreciated.

Posted by Guy Lingard Mar 28, 2010
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Team Foundation Server Hosting
Become a Sponsor