Calendar Event Does Not Repeat with UNTIL Property in Recurrence Rule

public class ImportCalendarPstFormatProcess {
public static final String PST_CL = "/CalendarOffice.pst";
private CalendarItem event;


@Before
public void init() {

	Calendar cal = Calendar.getInstance();
	cal.set(2021, Calendar.MAY, 26, 0, 0, 0);
	cal.set(2021, Calendar.MAY, 26, 0, 0, 0);

	
	event = new CalendarItem();
	event.setRecurrenceRule("RRULE:FREQ=DAILY;UNTIL=20210814T060000Z;INTERVAL=1");
	event.setSubject("RRULE");
	event.setStart(cal.getTime());
	event.setEnd(cal.getTime());
}


@Test
public void testCalendarWithRRule() {
	Locale.setDefault(new Locale("en-us"));

	PersonalStorage pst = PersonalStorage.create(System.getProperty("user.dir") + PST_CL, FileFormatVersion.Unicode);
	FolderInfo fi = pst.createPredefinedFolder("Calendar", StandardIpmFolder.Appointments);
	FolderInfo subFolder = fi.addSubFolder("Calendar RRULE", fi.getContainerClass());

	
	DateFormat formatter = new SimpleDateFormat("yyyyMMdd'T'HHmmss");
	String pattern = String.format("DTSTART:%s\r\nDTEND:%s\r\n%s",
			formatter.format(event.getStart()),
			formatter.format(event.getEnd()),
			event.getRecurrenceRule()
	);

	MapiCalendar appointment = new MapiCalendar(
			"LAKE ARGYLE WA 6743",
			event.getSubject(),
			"Description",
			event.getStart(),
			event.getEnd()
	);

	var recurrence = new MapiCalendarEventRecurrence();
	recurrence.setRecurrencePattern(MapiCalendarRecurrencePatternFactory.fromString(pattern));
	appointment.setRecurrence(recurrence);
	subFolder.addMapiMessageItem(appointment);

	Assert.assertTrue(new File(System.getProperty("user.dir") + PST_CL).exists());
}

}

@Viktoriia,
Thank you for posting the query. Unfortunately, I cannot use your code snippet to investigate the issue because it contains the unknown CalendarItem class. Please check the problem using the latest version of Aspose.Email. If the issue persists, please share a comprehensive code example.

Im using the latest version

@Test
public void testCalendarWithRRule() {
	Locale.setDefault(new Locale("en-us"));

	Calendar calendar = Calendar.getInstance();
	calendar.set(2021, Calendar.MAY, 26, 0, 0, 0);
	calendar.set(2021, Calendar.MAY, 26, 0, 0, 0);

	PersonalStorage pst = PersonalStorage.create(System.getProperty("user.dir") + PST_CL, FileFormatVersion.Unicode);
	FolderInfo fi = pst.createPredefinedFolder("Calendar", StandardIpmFolder.Appointments);
	FolderInfo subFolder = fi.addSubFolder("Calendar RRULE", fi.getContainerClass());

	
	DateFormat formatter = new SimpleDateFormat("yyyyMMdd'T'HHmmss");
	String pattern = String.format("DTSTART:%s\r\nDTEND:%s\r\n%s",
			formatter.format(calendar.getTime()),
			formatter.format(calendar.getTime()),
			"RRULE:FREQ=DAILY;UNTIL=20210814T060000Z;INTERVAL=1"
	);

	MapiCalendar appointment = new MapiCalendar(
			"LAKE ARGYLE WA 6743",
			"Test event with UNTIL property",
			"Description",
			calendar.getTime(),
			calendar.getTime()
	);

	var recurrence = new MapiCalendarEventRecurrence();
	recurrence.setRecurrencePattern(MapiCalendarRecurrencePatternFactory.fromString(pattern));
	appointment.setRecurrence(recurrence);
	subFolder.addMapiMessageItem(appointment);

	Assert.assertTrue(new File(System.getProperty("user.dir") + PST_CL).exists());
}

@Viktoriia,
Thank you for the code example. I reproduced the problem with UNTIL property and logged the issue with ID EMAILJAVA-34941. Our development team will investigate this case. We will inform you of any progress.

Hi @Andrey_Potapov, can you tell me when current issue will fix ? Because we are already bought licence and we need to know how much time need more

@Viktoriia,
Far as I can see, our development team is investigating the issue. I requested an estimated time to fix the problem you described. I will let you know soon.

@Viktoriia,
The problem with UNTIL property will be fixed in Aspose.Email 21.9 (closer to the beginning of October). We apologize for any inconvenience.

As a workaround, please try to use the following code example to initialize MapiCalendarRecurrencePattern:

//recurrence.setRecurrencePattern(MapiCalendarRecurrencePatternFactory.fromString(pattern));

MapiCalendarRecurrencePattern dailyPattern = new MapiCalendarDailyRecurrencePattern();
recurrence.setRecurrencePattern(dailyPattern);

dailyPattern.setPatternType(MapiCalendarRecurrencePatternType.Day);
dailyPattern.setPeriod(1);
dailyPattern.setEndType(MapiCalendarRecurrenceEndType.EndAfterDate);
calendar.set(2021, Calendar.AUGUST, 14, 6, 0, 0);
dailyPattern.setEndDate(calendar.getTime());

More examples: Working with Recurrences
API Reference: MapiCalendarDailyRecurrencePattern Class

The issues you have found earlier (filed as EMAILJAVA-34941) have been fixed in this update.