次の方法で共有


方法 : 予定を削除する

更新 : 2007 年 11 月

対象

このトピックの情報は、指定された Visual Studio Tools for Office プロジェクトおよび Microsoft Office のバージョンにのみ適用されます。

プロジェクトの種類

  • アプリケーション レベルのプロジェクト

Microsoft Office のバージョン

  • Outlook 2003

  • Outlook 2007

詳細については、「アプリケーションおよびプロジェクトの種類別の使用可能な機能」を参照してください。

この例では、定期的な予定の 1 つのインスタンスを削除します。この例では、定期的な予定のインスタンスが 2006 年 6 月 28 日の午前 8 時に発生することを前提としています。

使用例

Private Sub ThisAddIn_Startup(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles Me.Startup

    Dim calendar As Outlook.MAPIFolder = _
        Application.Session.GetDefaultFolder( _
        Outlook.OlDefaultFolders.olFolderCalendar)

    Dim calendarItems As Outlook.Items = calendar.Items

    Dim item As Outlook.AppointmentItem = TryCast( _
        calendarItems("Test Appointment"), Outlook.AppointmentItem)

    Dim pattern As Outlook.RecurrencePattern = _
        item.GetRecurrencePattern()

    Dim itemDelete As Outlook.AppointmentItem = _
        pattern.GetOccurrence(New Date(2006, 6, 28, 8, 0, 0))

    If itemDelete IsNot Nothing Then
        itemDelete.Delete()
    End If
End Sub
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
    Outlook.MAPIFolder calendar = 
        Application.Session.GetDefaultFolder(
         Outlook.OlDefaultFolders.olFolderCalendar);

    Outlook.Items calendarItems = calendar.Items;

    Outlook.AppointmentItem item = 
        calendarItems["Test Appointment"] as Outlook.AppointmentItem;

    Outlook.RecurrencePattern pattern = 
        item.GetRecurrencePattern();
    Outlook.AppointmentItem itemDelete = pattern.
        GetOccurrence(new DateTime(2006,6,28,8,0,0));

    if (itemDelete != null)
    {
        itemDelete.Delete();
    }
}

参照

処理手順

方法 : 予定を作成する

方法 : カスタムの予定表を作成する

方法 : 会議出席依頼を作成する

概念

予定表アイテムの操作

アプリケーション レベルのアドインのプログラミングについて