How to delete recurring appointment of speific date in outlook from vb.net

Following example deletes one instance of a recurring appointment.

    Private Sub DeleteAppointment(ByVal DefaultProp As String, ByVal AppointmentDate As Date)
 
        Dim outLookApp As New Outlook.Application()
        Dim objNameSpace As Outlook.NameSpace = outLookApp.GetNamespace("MAPI")
        Dim calendar As Outlook.MAPIFolder = objNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar)
        Dim calendarItems As Outlook.Items = calendar.Items
        Dim item As Outlook.AppointmentItem = TryCast(calendarItems(DefaultProp), Outlook.AppointmentItem)
        Dim RecurrPattern As Outlook.RecurrencePattern = item.GetRecurrencePattern()
        Dim itemForDelete As Outlook.AppointmentItem = RecurrPattern.GetOccurrence(AppointmentDate)
        If itemForDelete IsNot Nothing Then
            itemForDelete.Delete()
        End If
 
    End Sub

[Code help]

Default prop is the index of the appointment item in outlook or a value based to match the default property of an appointment item in the appointment items collection of calander
AppointmentDate is the datetime of that appointment

Suppose you want to delete an appointment with subject ‘Test’ of today, then you need to call above function like this:

DeleteAppointment(“test”, DateTime.Now)