Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This example deletes one instance of a recurring appointment. The example assumes that an instance of a recurring appointment occurs on June 28, 2006, at 08:00.
Applies to: The information in this topic applies to application-level projects for Outlook 2013 and Outlook 2010. For more information, see Features Available by Office Application and Project Type.
Example
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();
}
}
See Also
Tasks
How to: Programmatically Create Appointments
How to: Programmatically Create a Custom Calendar
How to: Programmatically Create a Meeting Request