Click here to Skip to main content
13,048,584 members (94,397 online)
Click here to Skip to main content
Add your own
alternative version


21 bookmarked
Posted 4 Jan 2004

How to Create Birthday Reminders Using Microsoft Outlook, in C#

, 4 Jan 2004
Rate this:
Please Sign up or sign in to vote.
This article shows you how to use microsoft Outlook appointments. I used a version of the code to put reminders in for my family members.


It might not be rocket science to create appointments in Microsoft Outlook but nevertheless, doing it in C# code cost me more effort than it should have. Anyway, here is a very simple example of how to create yearly recurring reminders, which I use to create reminders of birthdays for my family.

Doing this in C# was of course not easier than just using the Outlook user interface. Writing code for the sake of it is not very productive. So, why write code like this? Well, 2 reasons:

  1. Because examples in this subject domain are relatively scarce. The only example I could find in MSDN was one in Java, which wasn't very well written either.
  2. I have a different application which integrates with Outlook using VB6 and I wanted to see how easy it is in C#.

The Code

static void Main(string[] args)
   Outlook._Application olApp = 
       (Outlook._Application) new Outlook.Application();
   Outlook.NameSpace mapiNS = olApp.GetNamespace("MAPI");
   string profile = "";
   mapiNS.Logon(profile, null, null, null);

   //create an appointment in the Calendar folder
    CreateYearlyAppointment(olApp, "Birthday", "Kim"new DateTime(2004, 03,08, 7, 0, 0));
    CreateYearlyAppointment(olApp, "Birthday", "Lorraine",  
      new DateTime(2004, 02,21, 7, 0, 0));
    CreateYearlyAppointment(olApp, "Birthday", 
      "Evellyn",   new DateTime(2004, 05,29, 7, 0, 0));
    CreateYearlyAppointment(olApp, "Birthday", 
      "Mum", new DateTime(2004, 12,13, 7, 0, 0));
    CreateYearlyAppointment(olApp, "Tax",  
      "Quarterly tax bill", new DateTime(2004, 03,02, 7, 0, 0));
   catch(Exception ex) 
    MessageBox.Show( ex.Message + " : " + ex.StackTrace); 
   MessageBox.Show("Appointments Created - toodle pip!");
  static void CreateYearlyAppointment(Outlook._Application olApp, 
                 string reminderComment, string person, DateTime dt)
   // Use the Outlook application object to create an appointment
   Outlook._AppointmentItem apt = (Outlook._AppointmentItem)
   // set some properties
   apt.Subject = person + " : " + reminderComment;
   apt.Body = reminderComment;

   apt.Start = dt;
   apt.End   = dt.AddHours(1);

   apt.ReminderMinutesBeforeStart = 24*60*7 * 1;  // One week
   // Makes it appear bold in the calendar - which I like!
   apt.BusyStatus = Outlook.OlBusyStatus.olTentative;  
   apt.AllDayEvent = false;
   apt.Location = "";

   Outlook.RecurrencePattern myPattern = apt.GetRecurrencePattern();
   myPattern.RecurrenceType = Outlook.OlRecurrenceType.olRecursYearly;
   //myPattern.Regenerate = false;
   myPattern.Interval = 1;


Never forget your Mums birthday again!


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Frank Eden
Web Developer
Australia Australia
Frank has been in computing since the age of the dinosaurs. He prefers playing table tennis to writing C#, C++, VB, or any of the other dozen or more languages he has written since the Jurasic.

You may also be interested in...


Comments and Discussions

Generalno idea wat 2 do with downloaded file [modified] Pin
robofoz15-Aug-06 23:06
memberrobofoz15-Aug-06 23:06 
GeneralRemote Connection Pin
ricaforrica20-Jun-05 23:31
memberricaforrica20-Jun-05 23:31 
QuestionHow to specify which Calendar to add the appointment?? Pin
Hung Over5-Jan-05 11:06
memberHung Over5-Jan-05 11:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 5 Jan 2004
Article Copyright 2004 by Frank Eden
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid