1

When I get involved with a project that is already running the project lead or scrum master forwards an appointment series like daily stand-ups or similar. The series started before I receive the invitation.

Example:

  • The series starts on January, 11th 2021 (Monday) and re-occurs every week.
  • I receive the invitation on March, 16th 2021 (Tuesday).

When I look into my calendar I will see this appointment in January, February etc. although I didn't participate because I wasn't assigned. To keep my calendar in a way that shows what happened I manually remove those occurrences.

What I want to achieve:

  • The invitation enters my inbox.
  • Application_NewMailEx is triggered and checks for a series like the following.
(...)
If TypeName(objInboxObject) = "MeetingItem" Then
    Set objAppt = objInboxObject.GetAssociatedAppointment(False)
    If Not objAppt Is Nothing Then
        If objAppt.IsRecurring Then
            Set objRecurrPatt = objAppt.GetRecurrencePattern
            If Not objRecurrPatt Is Nothing Then
(...)

How I can I find out the next future occurrence starting from today (the date I received it)? In the example this would be March, 22nd 2021. Especially if the re-occurrence pattern is more complex than in the example.

I would replace the start date of the series with this calculated date and save the MeetingItem. If I accept it in the normal Outlook window I will have calendar entries in the future and none in the past.

Community
  • 1
  • 1
ByteBandit
  • 43
  • 1
  • 3

1 Answers1

0

Analyzing the RecurrencePattern object you can find the date of the next occurrence. Then you can use the RecurrencePattern.GetOccurrence method which returns a specific instance of the AppointmentItem object on the specified date. The GetOccurrence method generates an error if no appointment of that series exists on the specified date.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45