Porady: Programowane usuwanie terminów
W tym przykładzie Usuwa jedno wystąpienie terminu cyklicznego.W przykładzie założono, że wystąpienie terminu cyklicznego występuje 28 czerwca 2006 r., 08: 00.
Zastosowanie: Informacje przedstawione w tym temacie mają zastosowanie do projektów na poziomie aplikacji obsługiwanych w programach Outlook 2013 i Outlook 2010. Aby uzyskać więcej informacji, zobacz Funkcje dostępne w aplikacjach pakietu Office i typ projektu.
Przykład
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();
}
}
Zobacz też
Zadania
Porady: Programowane tworzenie terminów
Porady: Programowane tworzenie niestandardowego kalendarza
Porady: Programowane tworzenie wezwania na spotkanie
Koncepcje
Wprowadzenie do programowania dodatków na poziomie aplikacji