Hello team,
I’m working with recurring events in PST with C# Aspose.Email 21.6.
As far as I know, modified occurrence is saved as MapiAttachment on MapiCalendar. But the Appointment sub type property of modified occurrence is missing when I convert the occurrence to a Mapi Message or a Mapi Calendar.
Related PST file
test.zip (31.7 KB)
Sample Code:
var ps = PersonalStorage.FromFile(@"F:\\test.pst");
var folders = ps.RootFolder.GetSubFolders();
var calendarFolder = folders.Find(f => f.DisplayName.Equals("Calendar", StringComparison.OrdinalIgnoreCase));
var items = calendarFolder.GetContents();
foreach (var i in items)
{
try
{
var message = ps.ExtractMessage(i);
var calendar = message.ToMapiMessageItem() as MapiCalendar;
var masterSubType = calendar.GetProperty(KnownPropertyList.AppointmentSubType);
foreach(var exception in calendar.Recurrence.RecurrencePattern.Exceptions)
{
var subType = exception.SubType;
}
foreach(var att in calendar.Attachments)
{
if(att.ObjectData != null && att.ObjectData.IsOutlookMessage)
{
var embeddedMessage = att.ObjectData.ToMapiMessage();
var embeddedCalendar = embeddedMessage.ToMapiMessageItem() as MapiCalendar;
var propertyInObjectData = att.ObjectData.Properties.GetProperty(KnownPropertyList.AppointmentSubType);
var propertyInEmbeddedMessage = embeddedMessage.GetProperty(KnownPropertyList.AppointmentSubType);
var propertyInEmbeddedCalendar = embeddedCalendar.GetProperty(KnownPropertyList.AppointmentSubType);
}
}
}
catch (Exception ex)
{
//ignored
}
}
There are 4 events in PST file.
One is called FindAtimeWithAllDay.
It’s a recurring not all day events which the second occurrence is modified to an all day event.
With below codes,
propertyInObjectData is correct, value is true which means the occurrence is all day.
But propertyInEmbeddedMessage and propertyInEmbeddedCalendar is null. The property is missing.
PS, the subtype in RecurrencePattern.Exceptions is correct as 1.
Similar issue occurred when handle event called AllDayWithFindATime.
The event series is an all day event while the second occurrence is modified to a not all day event.
The value of subtype and propertyInObjectData is correct while the propertyInEmbeddedMessage and propertyInEmbeddedCalendar is null.
The issue make the modified occurrence not show as expect.
Thanks,