Click here to Skip to main content
Licence 
First Posted 4 Jan 2004
Views 83,017
Bookmarked 40 times

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

By | 4 Jan 2004 | Article
This article shows you hot to use Microsoft Outlook appointments. I used a version of the code to put reminders in for my family members.

Introduction

I guess it isn't rocket science to put birthday reminders into Outlook, but nevertheless, doing it in C# code cost me more effort than it should have. So without further ado, here is the code.

Steps

  1. Ensure you reference Microsoft Outlook, then create a new application.
    Outlook._Application olApp = 
       (Outlook._Application) new Outlook.Application();
  2. Log on. (I think email needs to be running)
    Outlook.NameSpace mapiNS = olApp.GetNamespace("MAPI")
    string profile = "";
    mapiNS.Logon(profile, null, null, null);
  3. Repeat the line.
    CreateYearlyAppointment(olApp, "Birthday", 
       "Kim", new DateTime(2004, 03,08, 7, 0, 0));

    for your wife and kids etc. etc.!!!

The Code

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)
    olApp.CreateItem(Outlook.OlItemType.olAppointmentItem);
  
   // 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 reminder
   
   // 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.Interval = 1;
   apt.Save();
  }

Reap The Rewards

With a one week reminder, you will never again forget your Mum's birthday.

License

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

Member

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.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralError when creating birthday reminder in ASP.NET PinmemberSimomo3:30 23 Mar '09  
QuestionAdding the reminder in a Calendar in Public Folder?? PinmemberRahul Vac23:27 26 Mar '07  
QuestionRegarding to creating Birthday Reminder PinmemberThimani18:27 12 Feb '07  
GeneralSolution if you get error 80004005 PinmemberKirbzStar14:56 28 Nov '06  
GeneralLogon without Outlook Running Pinmembermtbbiker1:35 3 Oct '05  
Questionversion independent ? Pinmemberfracalifa23:50 31 Mar '05  
GeneralError Outlook unrecoqnized Pinsusschikku22:28 8 Mar '04  
GeneralRe: Error Outlook unrecoqnized Pinmemberpartyganger23:56 8 Mar '04  
GeneralRe: Error Outlook unrecoqnized PinmemberNITH3:35 30 Apr '04  
GeneralError Outlook unrecoqnized Pinmemberchikku22:27 8 Mar '04  
QuestionAnyone ported this to C#? Pinmemberdragomir0:02 3 Feb '04  
AnswerRe: Anyone ported this to C#? PinmemberNITH3:27 30 Apr '04  
QuestionCreate a message rule? Pinmemberdragomir22:33 22 Jan '04  
AnswerRe: Create a message rule? PinmemberFrank Eden11:50 26 Jan '04  
GeneralSending Outlook items PinsussAnonymous1:30 13 Jan '04  
GeneralRe: Sending Outlook items PinmemberFrank Eden10:59 13 Jan '04  
GeneralExcellent article PinsussPer Søderlind21:30 5 Jan '04  
GeneralRe: Excellent article PinmemberNITH3:29 30 Apr '04  
GeneralWhats the purpose Pinmembersuper18:29 5 Jan '04  
GeneralRe: Whats the purpose PinmemberFrank Eden18:54 5 Jan '04  
GeneralRe: Whats the purpose PinmembergUnOm22:49 20 Feb '05  
GeneralRe: Whats the purpose PinmemberMalik Nasir22:55 14 May '06  
i also unable to understand the purpose of this article this thing already avaiable in outlook then why to implement thi.
actually i was searching some material to implement Add-In for outlook
so if you can help me please provide me some info about it.
regards
GeneralRe: Whats the purpose Pinmemberlaribum2:44 4 Sep '06  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web03 | 2.5.120529.1 | Last Updated 5 Jan 2004
Article Copyright 2004 by Frank Eden
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid