Hi,
I’m trying to create a recurring appointment (MapiCalendar) and add it to a PST file.
I want to create a daily recurrence, with 3 occurrences (partial code):
// Create a daily appointment
MapiCalendarEventRecurrence mapiCalendarEventRecurrence = new MapiCalendarEventRecurrence();
MapiCalendarDailyRecurrencePattern recurrencePattern = new MapiCalendarDailyRecurrencePattern();
recurrencePattern.Period = 1;
recurrencePattern.PatternType = MapiCalendarRecurrencePatternType.Day;
recurrencePattern.EndType = MapiCalendarRecurrenceEndType.EndAfterNOccurrences;
recurrencePattern.OccurrenceCount = 3;
mapiCalendarEventRecurrence.RecurrencePattern = recurrencePattern;
MapiCalendar appointment = new MapiCalendar(…);
appointment.Recurrence = mapiCalendarEventRecurrence;
// Create the pst and add the appointment to folder "Calendar"
PersonalStorage pst = PersonalStorage.Create(…);
FolderInfo calendarFolder = pst.CreatePredefinedFolder(“Calendar”, StandardIpmFolder.Appointments);
calendarFolder.AddMapiMessageItem(appointment);
Observations:
1) When I open the PST file in Outlook, the appointment recurrence never ends, although I specified “OccurenceCount = 3” (see attached: DailyRecurringPst.png).
2) I tried to set ClipStart and ClipEnd properties in the recurrence object but it didn’t help.
3) I also tried to save the appointment to .ics format, and when I open it in Outlook, this time the recurrence is correct (see attached: DailyRecurringPst.png).
What’s the proper way of creating a recurrent appointment in a PST file?
I attached the full code to this post (mapiCalendarRecurrences.txt).
Hi Gabriela,
Thank you for contacting Aspose support team.
I have tested the scenario using following sample code and opened the resultant PST in Outlook 2013. It is observed that only three occurrences are there, and no unlimited recurrences are observed. Could you please give a try to the following sample code and let us know the feedback?
string path = "Email_641496";
var recDaily = new MapiCalendarDailyRecurrencePattern
{
PatternType = MapiCalendarRecurrencePatternType.Day,
Period = 1,
WeekStartDay = DayOfWeek.Sunday,
EndType = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
OccurrenceCount = 3,
};
MapiCalendarEventRecurrence mapiCalendarEventRecurrence = new MapiCalendarEventRecurrence();
mapiCalendarEventRecurrence.RecurrencePattern = recDaily;
MapiCalendar appointment = new MapiCalendar("Location", "Summary", "Description", new DateTime(2015, 7, 20), new DateTime(2015, 7, 31));
appointment.Recurrence = mapiCalendarEventRecurrence;
// Create the pst and add the appointment to folder "Calendar"
PersonalStorage pst = PersonalStorage.Create(path + "output.pst", FileFormatVersion.Unicode);
FolderInfo calendarFolder = pst.CreatePredefinedFolder("Calendar", StandardIpmFolder.Appointments);
calendarFolder.AddMapiMessageItem(appointment);
Hi,
Thank you for your reply.
I have tested your code and it now works (the license was not properly set).
However, I don’t understand how you set the dates?
The only dates you specified are “2015-07-20” and “2015-07-31”.
For instance, how do I specify that the appointment should be “From 8:00AM to 9:00AM” for every day of the recurrence?
I replaced this line from your code:
MapiCalendar appointment = new MapiCalendar(“Location”,“Summary”,“Description”,new DateTime(2015,7,20),new DateTime(2015,7,31));
with:
MapiCalendar appointment = new MapiCalendar(“Location”, “Summary”, “Description”, new DateTime(2015, 7, 20, 8, 0, 0), new DateTime(2015, 7, 20, 9, 0, 0));
Now when I open the PST in Outlook, it looks correct except the first instance which is missing (see attached).
What’s the proper way of setting the datetimes of the appointment instances?
Hi Gabriela,
Hi,
I downloaded the latest release of Aspose.Email for .NET (5.6.0) from your website, but I’m still seeing the “first instance missing” issue.
I’m trying to create a weekly meeting from Jun 30, 2015 to Aug 1, 2015 every Tuesday.
Code: mapiCalendarRecurrenceBug.txt.
I opened the PST file in Outlook and the first instance of the recurrence is missing (Jun 30)
Screenshot: MissingFirstInstance.PNG.
When I open the appointment, the start date is correct. However, the end date shows the date of the last instance (7/28/2015) instead of 1/8/2015, and the datetimes are wrong.
"Occurs every Tuesday effective 6/30/2015 until 7/28/2015 from 2:00 PM to 4:00 PM"
Screenshot: AppointmentDates.PNG
Hi Gabriela,
Thanks for your reply.
Do you think this issue could be solved with the next release (5.7.0)?
Hi Gabriela,
Ok, got it.
Please keep me updated.
The issues you have found earlier (filed as EMAILNET-34961) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.