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.
- Ensure you reference Microsoft Outlook, then create a new application.
Outlook._Application olApp =
(Outlook._Application) new Outlook.Application();
- Log on. (I think email needs to be running)
Outlook.NameSpace mapiNS = olApp.GetNamespace("MAPI")
string profile = "";
mapiNS.Logon(profile, null, null, null);
- Repeat the line.
"Kim", new DateTime(2004, 03,08, 7, 0, 0));
for your wife and kids etc. etc.!!!
static void CreateYearlyAppointment(Outlook._Application olApp,
string reminderComment, string person, DateTime dt)
Outlook._AppointmentItem apt = (Outlook._AppointmentItem)
apt.Subject = person + " : " + reminderComment;
apt.Body = reminderComment;
apt.Start = dt;
apt.End = dt.AddHours(1);
apt.ReminderMinutesBeforeStart = 24*60*7 * 1;
apt.BusyStatus = Outlook.OlBusyStatus.olTentative;
apt.AllDayEvent = false;
apt.Location = "";
Outlook.RecurrencePattern myPattern = apt.GetRecurrencePattern();
myPattern.RecurrenceType = Outlook.OlRecurrenceType.olRecursYearly;
myPattern.Interval = 1;
Reap The Rewards
With a one week reminder, you will never again forget your Mum's birthday.