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

Free Support Forum - aspose.com

How to set daily-weakly-monthly-yearly recurrence pattern in calendar(.pst file) using Aspose.email for java version 6.3.0

Hello support team,


I am mac os x developer. I have to set weakly,monthly,yearly recurrence pattern to calendar in .pst file. I am using aspose.email for java (jar file).

Below are input and source code .

please give me proper solution for that .

****Source Code

java.util.Calendar calendar = java.util.Calendar.getInstance(java.util.TimeZone.getTimeZone(“GMT”));

calendar.set(2015, java.util.Calendar.JANUARY, 1,0,0,0);

Date startDate = calendar.getTime();

calendar.set(2016, java.util.Calendar.MARCH, 1,0,0,0);

Date endDate = calendar.getTime();

MapiCalendarEventRecurrence f_reccurence = new MapiCalendarEventRecurrence();

f_reccurence.setRecurrencePattern(new MapiCalendarWeeklyRecurrencePattern());

f_reccurence.getRecurrencePattern().setPatternType(MapiCalendarRecurrencePatternType.Week);

f_reccurence.getRecurrencePattern().setOccurrenceCount(3);

f_reccurence.getRecurrencePattern().setPeriod(2);

f_reccurence.getRecurrencePattern().setEndType(MapiCalendarRecurrenceEndType.NeverEnd);

mapiWeakly = new MapiCalendar(“This is Location”, “This is Weekly”, “This is description”,startDate, endDate);

mapiWeakly.setLocation(“This is location”);

mapiWeakly.setRecurrence(f_reccurence);



*************************************************

NOTE:- hello sir , I am using aspose.email for java (jar file)version 6.3.0







Hi Ajinath,


Thank you for writing to Aspose support team.

We have tested the code and observed that Aspose.Email for Java is having issue while adding calendar recurrences to PST. This issue is logged under Id: EMAILJAVA-33574 for further investigation by the product team. You will be automatically notified once any update is received in this regard. Following code is used to re-produce the issue here.

<span style=“font-size:9.0pt;font-family:“Courier New”;
mso-fareast-font-family:“Times New Roman”;color:navy”>static private void
Email_704211_Monthly()

{

MapiCalendar mapiMonthly =
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:navy”>null
;

java.util.Calendar calendar =
java.util.Calendar.getInstance(java.util.TimeZone.getTimeZone(
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:green”>“GMT”
));



calendar.set(
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>2015, java.util.Calendar.<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:#660E7A”>JANUARY
, <span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>1, <span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>0, <span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>0, <span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>0);



Date startDate = calendar.getTime();



calendar.set(
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>2018, java.util.Calendar.<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:#660E7A”>MARCH
, <span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>1, <span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>0, <span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>0, <span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>0);



Date endDate = calendar.getTime();





MapiCalendarMonthlyRecurrencePattern
rec =
<span style=“font-size:9.0pt;font-family:“Courier New”;
mso-fareast-font-family:“Times New Roman”;color:navy”>new
MapiCalendarMonthlyRecurrencePattern();

rec.setPatternType(MapiCalendarRecurrencePatternType.
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:#660E7A”>Month
);

rec.setPeriod(
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>60);

rec.setWeekStartDay(
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>0);

rec.setEndType(MapiCalendarRecurrenceEndType.<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:#660E7A”>NeverEnd
);



MapiCalendarEventRecurrence
f_reccurence =
<span style=“font-size:9.0pt;font-family:“Courier New”;
mso-fareast-font-family:“Times New Roman”;color:navy”>new
MapiCalendarEventRecurrence();

f_reccurence.setRecurrencePattern(rec);



mapiMonthly =
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:navy”>new
MapiCalendar(<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:green”>“This is Location”
, <span style=“font-size:9.0pt;font-family:“Courier New”;
mso-fareast-font-family:“Times New Roman”;color:green”>“This is
Weekly”
, <span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:green”>“This is description”
,startDate, endDate);



mapiMonthly.setLocation(
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:green”>“This is location”
);


mapiMonthly.setRecurrence(f_reccurence);



PersonalStorage pst =
PersonalStorage.create(<span style=“font-size:9.0pt;
font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;color:green”>“output2.pst”
, FileFormatVersion.<span style=“font-size:9.0pt;
font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;color:#660E7A”>Unicode
);

FolderInfo calendarFolder =
pst.createPredefinedFolder(
<span style=“font-size:9.0pt;font-family:
“Courier New”;mso-fareast-font-family:“Times New Roman”;color:green”>“Calendar”
, StandardIpmFolder.<span style=“font-size:9.0pt;
font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;color:#660E7A”>Appointments
);

calendarFolder.addMapiMessageItem(mapiMonthly);



}

<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:
“Times New Roman”;color:navy”>static private void
Email_704211_Weekly()

{

MapiCalendar mapiWeekly =
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:navy”>null
;

java.util.Calendar calendar =
java.util.Calendar.getInstance(java.util.TimeZone.getTimeZone(
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:green”>“GMT”
));



calendar.set(
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>2015, java.util.Calendar.<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:#660E7A”>JANUARY
, <span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>1,<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>0,<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>0,<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>0);



Date startDate = calendar.getTime();



calendar.set(
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>2016, java.util.Calendar.<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:#660E7A”>MARCH
, <span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>1,<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>0,<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>0,<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>0);



Date endDate = calendar.getTime();





MapiCalendarEventRecurrence
f_reccurence =
<span style=“font-size:9.0pt;font-family:“Courier New”;
mso-fareast-font-family:“Times New Roman”;color:navy”>new
MapiCalendarEventRecurrence();



f_reccurence.setRecurrencePattern(
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:navy”>new
MapiCalendarWeeklyRecurrencePattern());


f_reccurence.getRecurrencePattern().setPatternType(MapiCalendarRecurrencePatternType.<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:#660E7A”>Week
);


f_reccurence.getRecurrencePattern().setOccurrenceCount(<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>2);






f_reccurence.getRecurrencePattern().setPeriod(<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue”>2);



f_reccurence.getRecurrencePattern().setEndType(MapiCalendarRecurrenceEndType.
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:#660E7A”>NeverEnd
);







mapiWeekly =
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:navy”>new
MapiCalendar(<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:green”>“This is Location”
, <span style=“font-size:9.0pt;font-family:“Courier New”;
mso-fareast-font-family:“Times New Roman”;color:green”>“This is
Weekly”
, <span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:green”>“This is description”
,startDate, endDate);



mapiWeekly.setLocation(
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:green”>“This is location”
);



mapiWeekly.setRecurrence(f_reccurence);



PersonalStorage pst =
PersonalStorage.create(
<span style=“font-size:9.0pt;
font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;color:green”>“output.pst”
, FileFormatVersion.<span style=“font-size:9.0pt;
font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;color:#660E7A”>Unicode
);

FolderInfo calendarFolder =
pst.createPredefinedFolder(
<span style=“font-size:9.0pt;font-family:
“Courier New”;mso-fareast-font-family:“Times New Roman”;color:green”>“Calendar”
, StandardIpmFolder.<span style=“font-size:9.0pt;
font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;color:#660E7A”>Appointments
);

calendarFolder.addMapiMessageItem(mapiWeekly);

}<o:p></o:p>

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.