We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

MapiCalendar recurrence pattern process is stuck

I`m using Aspose.Email Java for convert Google calendar events to pst format and I faced a problem with recurrence pattern. Please tell how to solve current issue

if (googleEventJson.has(RECURRENCE)) {
JsonNode recurrenceRulesArray = googleEventJson.get(RECURRENCE);
String rrule = recurrenceRulesArray.get(0).asText();

					String pattern = String.format("DTSTART;TZID=%s:%s\r\nDTEND;TZID=%s:%s\r\n%s",
							googleCalendarJson.get(TIME_ZONE).asText(),
							"20210711T000000",
							googleCalendarJson.get(TIME_ZONE).asText(),
							"20210711T000000",
							rrule
					);
					
					log.info("Pattern: {}", pattern);
					var recurrence = new MapiCalendarEventRecurrence();
					recurrence.setRecurrencePattern(MapiCalendarRecurrencePatternFactory.fromString(pattern));
					recurrence.setTimeZoneStruct(new MapiCalendarTimeZone(googleCalendarJson.get(TIME_ZONE).asText()));
					appointment.setRecurrence(recurrence);
				}

Google recurrence: “RRULE:FREQ=WEEKLY;BYDAY=SU”

@Viktoriia

Can you please share the working sample code and source file that I may use to verify and then log the issue on our issue tracking system for investigation.

I share you test source code, because example source code above used in project

public class PSTTest {
public static final String PST_CL = "Calendar.pst";
@Test
public void createPSTFile(){
	Locale.setDefault(new Locale("en-us"));
	calendar();
}

private void calendar(){
	Calendar cal = Calendar.getInstance();
	cal.set(2021, Calendar.JULY, 8, 13, 0, 0);
	Date startDate = cal.getTime();
	cal.set(2021, Calendar.JULY, 8, 14, 0, 0);
	Date endDate = cal.getTime();

	PersonalStorage pst = PersonalStorage.create(PST_CL, FileFormatVersion.Unicode);
	FolderInfo fi = pst.createPredefinedFolder("Calendar", StandardIpmFolder.Appointments);
	FolderInfo subFolder = fi.addSubFolder("Calendar Dima Test", fi.getContainerClass());

	MapiCalendar appointment = new MapiCalendar(

			"LAKE ARGYLE WA 6743",

			"Appointment",

			"This is a very important meeting :)",

			startDate,

			endDate

	);

	String rrule = "RRULE:FREQ=WEEKLY;BYDAY=SU";

	String pattern = String.format("DTSTART;TZID=%s:%s\r\nDTEND;TZID=%s:%s\r\n%s",
			"Europe/London",
			"20210711T000000",
			"Europe/London",
			"20210711T000000",
			rrule
	);
	
	var recurrence = new MapiCalendarEventRecurrence();
	recurrence.setRecurrencePattern(MapiCalendarRecurrencePatternFactory.fromString(pattern));
	recurrence.setTimeZoneStruct(new MapiCalendarTimeZone("Europe/London"));
	appointment.setRecurrence(recurrence);
	subFolder.addMapiMessageItem(appointment);
}

}

@Viktoriia

We need to further investigate the issue on our end and a ticket with ID EMAILJAVA-3491 has been created in our issue tracking system. This thread has been linked with the issue so that you may be notified once the issue will be addressed.