Export (0) Print
Expand All

How to: Create a Reminder for an Appointment Item

This example shows how to use the ReminderSet property to create a reminder for an appointment item.

Programming Applications for Office Outlook 2007

The following code example is an excerpt from Programming Applications for Microsoft Office Outlook 2007, from Microsoft Press (ISBN 9780735622494, copyright Microsoft Press 2007, all rights reserved).

Buy this book

Sample chapters

Outlook provides a way to set a reminder for an appointment by using the ReminderSet property of the AppointmentItem object. This property indicates whether a reminder has been created for the appointment. Setting the ReminderSet property to true creates a reminder, and setting it to false removes the reminder.

In the following code example, ReminderExample creates a reminder on a private appointment for wine tasting in Napa, California, and sets the reminder to occur two hours before the appointment starts. First, ReminderExample creates an Outlook AppointmentItem object. It then sets the Sensitivity property for the item to olPrivate. This indicates that the appointment is a private appointment. After setting other properties of the appointment, such as Start and End times, ReminderExample sets the ReminderMinutesBeforeStart property to indicate the number of minutes that the reminder will appear before the start of the appointment. In this case, ReminderMinutesBeforeStart is set to 120 minutes (two hours).

If you use Visual Studio to test this code example, you must first add a reference to the Microsoft Outlook 15.0 Object Library component and specify the Outlook variable when you import the Microsoft.Office.Interop.Outlook namespace. The using statement must not occur directly before the functions in the code example but must be added before the public Class declaration. The following line of code shows how to do the import and assignment in C#.

using Outlook = Microsoft.Office.Interop.Outlook;
private void ReminderExample()
{
    Outlook.AppointmentItem appt = Application.CreateItem(
        Outlook.OlItemType.olAppointmentItem)
        as Outlook.AppointmentItem;
    appt.Subject = "Wine Tasting";
    appt.Location = "Napa CA";
    appt.Sensitivity = Outlook.OlSensitivity.olPrivate;
    appt.Start = DateTime.Parse("10/21/2006 10:00 AM");
    appt.End = DateTime.Parse("10/21/2006 3:00 PM");
    appt.ReminderSet = true;
    appt.ReminderMinutesBeforeStart = 120;
    appt.Save();
}

Other resources

Show:
© 2014 Microsoft