共用方式為


建立約會專案的提醒

此範例示範如何使用 ReminderSet 屬性來建立約會專案的提醒。

範例

注意事項

下列程式代碼範例是 Microsoft Office Outlook 2007 程式設計應用程式的摘錄。

Outlook 提供使用 AppointmentItem 物件的 ReminderSet 屬性來設定約會提醒的方法。 這個屬性會指出是否已建立約會的提醒。 將 ReminderSet 屬性設定為 true 會建立提醒,並將它設定為 false 則會移除提醒。

在下列程式代碼範例中,ReminderExample 會在加州 Napa 的葡萄酒之私人約會上建立提醒,並將提醒設定為在約會開始前兩小時發生。 首先,ReminderExample 會建立 Outlook AppointmentItem 物件。 然後,它會將專案的 Sensitivity 屬性設定為 olPrivate。 這表示約會是私人約會。 設定約會的其他屬性之後,例如 [開始 ] 和 [ 結束 時間],ReminderExample 會設定 ReminderMinutesBeforeStart 屬性,以指出提醒將在約會開始之前出現的分鐘數。 在此情況下,ReminderMinutesBeforeStart 會設定為 120 分鐘, (兩小時) 。

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();
}

另請參閱