Yearly recurrence is not proper in calendar in PST using Aspose.Email for Java API

Hello Team,
I have create calendar with yearly recurrence pattern but recurrence is not show properly. Please refer below code and snapshot of output PST or output PST.

1)Source code :-

String f_Location = “Pune”;
String Subject = “Yearly after####”;
startDate = Wed Jul 12 14:00:00 IST 2017(Convert this date into java Date).
endDate = Wed Jul 12 14:30:00 IST 2017 (Convert this date into java Date).
MapiCalendar f_MapiCalendarObj = new MapiCalendar(f_Location,subject,subject, startDate, endByDate);
f_MapiCalendarObj.setReminderDelta(15);

//SET RECURRENCE PATTERN

MapiCalendarMonthlyRecurrencePattern rec = new MapiCalendarMonthlyRecurrencePattern();
{

	rec.setDay(Integer.parseInt(12));
        rec.setPeriod(1);
       rec.setPatternType(MapiCalendarRecurrencePatternType.Month);
       rec.setEndType(MapiCalendarRecurrenceEndType.EndAfterNOccurrences);
       rec.setOccurrenceCount(105);

};
//Generate recurrence event from the defined recurrence
MapiCalendarEventRecurrence reccurrence = new MapiCalendarEventRecurrence();
reccurrence.setRecurrencePattern(rec);

//now create mapi calendar and set its recurrence
f_MapiCalendarObj.setRecurrence(reccurrence);

    f_FolderInfoObj.addMapiMessageItem(f_MapiCalendarObj);

2)Snapshot of Issue :-
green mark indicate source of recurrence and red mark indicate wrong recurrence.

reccurences issue.png (322.7 KB)

3)Output PST :-
Data Records.pst.zip (96.9 KB)

@kharade.a,

You may please set period =12 for getting yearly recurrence as follows:

MapiCalendarMonthlyRecurrencePattern rec = new MapiCalendarMonthlyRecurrencePattern();
{
    rec.setDay(12);
    rec.setPeriod(12);
    rec.setPatternType(MapiCalendarRecurrencePatternType.Month);
    rec.setEndType(MapiCalendarRecurrenceEndType.EndAfterNOccurrences);
    rec.setOccurrenceCount(105);
};

Hi,
But my period is 1 not 12 . 12 is not my value then how can i set 12 as period. I have to set 1 as period.

@kharade.a,

As we are using MapiCalendarMonthlyRecurrencePattern to generate yearly pattern, we have to set number of months to 12, which corresponds to one year. Hence by setting period 12, we get 12 months pattern equivalent to a year. Please give it a try and provide us feedback after analyzing the output file in Outlook.

I got wrong recurrence. Please see provided recurrence issue.png and try at your end i have tried here. Original my start date and end date i provided you but after creation i got wrong start date and end date. Please try at your end and then replay me. Please help me.

@kharade.a,

I have used following sample code to generate intermediate message and PST file for final testing.

Date startDate = null;
java.util.Calendar cal = GregorianCalendar.getInstance();
cal.set(2017, 6, 11,14,0,0);
startDate = cal.getTime();

Date endDate = null;
cal.set(2017, 6, 11,14,30,0);
Date endByDate = cal.getTime();

MapiCalendar f_MapiCalendarObj = new MapiCalendar("f_Location","subject","subject", startDate, endByDate);
f_MapiCalendarObj.setReminderDelta(15);

//SET RECURRENCE PATTERN

MapiCalendarMonthlyRecurrencePattern rec = new MapiCalendarMonthlyRecurrencePattern();
{
    rec.setDay(12);
    rec.setPeriod(12);
    rec.setPatternType(MapiCalendarRecurrencePatternType.Month);
    rec.setEndType(MapiCalendarRecurrenceEndType.EndAfterNOccurrences);
    rec.setOccurrenceCount(105);
};
//Generate recurrence event from the defined recurrence
MapiCalendarEventRecurrence reccurrence = new MapiCalendarEventRecurrence();
reccurrence.setRecurrencePattern(rec);

//now create mapi calendar and set its recurrence
f_MapiCalendarObj.setRecurrence(reccurrence);
f_MapiCalendarObj.save("Yearly.msg",AppointmentSaveFormat.Msg);
//f_FolderInfoObj.addMapiMessageItem(f_MapiCalendarObj);
PersonalStorage pst = PersonalStorage.create("YearlyPattern.pst", FileFormatVersion.Unicode);
FolderInfo f_FolderInfoObj = pst.createPredefinedFolder("Calendar1", StandardIpmFolder.Appointments);

f_FolderInfoObj.addMapiMessageItem(f_MapiCalendarObj);

pst.dispose();

I can see the correct yearly recurrence as expected and similar to the output shared by you. I have attached the output MSG file, PST file and the image showing the recurrence in PST file while opened in Outlook.

Could you please give it a try and share the feedback?

YearlyMsg.zip (1.3 KB)
YearlyPatternPst.zip (132 Bytes)
YearlyRecurrence.png (40.4 KB)