Set recurrence in MapiCalendar and add it to PST file

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,


The end date which is mentioned in the sample code, is just to demonstrate that the recurrence count is effective. You may please use 2015-07-22 for your testing.

Regarding the first missing appointment, I have also observed this issue and I shall report it to the product team. You will be notified here, once the issue is logged in our bug tracking system.

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,


Thank you for contacting Aspose support again.

I have tested the scenario and observed the issues mentioned by you. These issues are logged under id: EMAILNET-34961 for further investigation by the product team. I shall write here as soon as some feedback is received in this regard.

Thanks for your reply.

Do you think this issue could be solved with the next release (5.7.0)?

Hi Gabriela,


Since the issue has been reported too recently, we are not sure if this will be fixed in the upcoming version of the API. We have requested an ETA from our Product team about this and shall write here when there is some information available about this issue.

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.