MapiCalendar recurrence with end date

Consider the following recurrence pattern.
1.PNG (29.3 KB)
The recurrence is a monthly one and starts at 12:00 am 17th and ends at 2:30 am 19th. The recurrence pattern starts on Oct 2019 and ends by Jul 2020.

The following code has been used to create an appointment with this type for recurrence.

        SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
        dateFormat.setTimeZone(TimeZone.getDefault());
        Date fromTime = dateFormat.parse("17-10-2019 12:00:00"), toTime = dateFormat.parse("19-10-2019 02:30:00");
        MapiCalendar mapiCalendar = new MapiCalendar();
        MailAddressCollection mailAddressCollection = new MailAddressCollection();
        mailAddressCollection.addItem(new MailAddress("abc@abc.com", "abc"));
        Appointment appointment = new Appointment("", fromTime, toTime, new MailAddress("abc@abc.com", "abc"), mailAddressCollection);
        MailMessage msg = new MailMessage();
        msg.addAlternateView(appointment.requestApointment());
        MapiMessage mapi = MapiMessage.fromMailMessage(msg);
        mapiCalendar = (MapiCalendar) mapi.toMapiMessageItem();
        mapiCalendar.setAllDay(false);
        mapiCalendar.setAppointmentCounterProposal(false);
        mapiCalendar.setBusyStatus(MapiCalendarBusyStatus.Free);
        mapiCalendar.setClientIntent(0);
        mapiCalendar.setReminderDelta(1080);
        mapiCalendar.setReminderSet(true);
        MapiCalendarRecurrencePattern recurrencePattern = new MapiCalendarYearlyAndMonthlyRecurrencePattern();
        recurrencePattern.setPatternType(MapiCalendarRecurrencePatternType.Month);
        recurrencePattern.setCalendarType(MapiCalendarRecurrenceCalendarType.Default);
        recurrencePattern.setPeriod(1);
        recurrencePattern.setEndType(MapiCalendarRecurrenceEndType.NeverEnd);
        recurrencePattern.setSlidingFlag(false);
        ((MapiCalendarYearlyAndMonthlyRecurrencePattern)recurrencePattern).setDay(17);
        recurrencePattern.setEndType(MapiCalendarRecurrenceEndType.EndAfterDate);
        recurrencePattern.setOccurrenceCount(10);
        recurrencePattern.setWeekStartDay(0);
        recurrencePattern.setStartDate(dateFormat.parse("17-10-2019 00:00:00"));
        recurrencePattern.setEndDate(dateFormat.parse("19-07-2020 02:30:00"));
        MapiCalendarEventRecurrence mapiCalendarEventRecurrence = new MapiCalendarEventRecurrence();
        mapiCalendarEventRecurrence.setRecurrencePattern(recurrencePattern);
        mapiCalendarEventRecurrence.setClipStart(dateFormat.parse("17-10-2019 00:00:00"));
        mapiCalendarEventRecurrence.setClipEnd(dateFormat.parse("17-07-2020 00:00:00"));
        mapiCalendar.setRecurrence(mapiCalendarEventRecurrence);
        mapiCalendar.setBodyContent("<DIV STYLE=\"text-align:Left;font-family:Segoe UI;font-style:normal;font-weight:normal;font-size:12;color:#000000;\"><P STYLE=\"font-family:Calibri;font-size:14.666666666666666;margin:0 0 0 0;\"><SPAN><SPAN>test</SPAN></SPAN></P></DIV>", 2);
        mapiCalendar.setSubject("test recurring event");

But this code ended up creating an item with this recurrence.
2.PNG (29.5 KB)
PFA. Test3.zip (1.2 KB)

Please assist on where I went wrong.

@nandhini.r.17.96,

I have observed the requirements shared by you and request you to please first try using latest Aspose.Email for Java 19.8 on your end and in case the issue is observed, please also share the PST file as well. I also suggest you to please visit the concerned similar .NET based section of documentation dealing with monthly recurrances.

@mudassir.fayyaz

I am using the latest version 19.8. The PST created by the above code is attached here for reference. new-1.zip (6.9 KB)

The item I’m trying to create is like the one in this pst original.zip (18.9 KB)

@nandhini.r.17.96,

I have worked with the sample file shared by you and have been able to observe the issue. An issue with ID EMAILJAVA-34595 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.