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

Free Support Forum - aspose.com

MapiCalendar not honouring MAPI properties when generating MIME

I want to generate the MIME from a collection of MAPI properties. I’m doing this by creating a MapiCalendar object, populating its MAPI properties and saving as MIME, but I find some MAPI properties are honoured and some are not. For instance, the start time of a calendar item in the MIME output is only ever taken from the StartDate property on the calendar item and not overwritten by the MAPI property for start date - but the MIME subject is always the same as the MAPI property for subject.

Here’s some code to illustrate:

using System.Text;
using Aspose.Email.Calendar;
using Aspose.Email.Mapi;

const int PR_START_DATE = 0x00600040;
const int PR_SUBJECT = 0x0037001F;

using var stream = new MemoryStream();
var cal = new MapiCalendar();

cal.StartDate = new DateTime(2011, 1, 1, 1, 1, 1);
cal.Subject = "Subject from object property";

cal.SetProperty(new PidTagPropertyDescriptor(PR_START_DATE), new DateTime(2012, 2, 2, 2, 2, 2));
cal.SetProperty(new PidTagPropertyDescriptor(PR_SUBJECT), "Subject from MAPI property");

cal.Save(stream, AppointmentSaveFormat.Ics);

// Generated MIME includes the lines:
//      DTSTART:20110101T010101
//      SUMMARY:Subject from MAPI property
// So it's taken the MAPI version of the subject but object property for start date

Is there a way to “synchronize” the calendar object’s properties to the MAPI property values, so that the MIME accurately reflects the MAPI properties. If not, what’s the point of being able to save a MAP object as MIME if it ignores most of the properties?

I’ve examined the MAPI properties on a calendar item and found 6 properties that have the same value as the start date and have set all of these on the calendar item but none of them influence the start date of the calendar item in the generated MIME.

We’re in the process of purchasing Aspose.Email, so I may shortly be able to redirect the question to the paid support route.

Hello @RobertHunt,

You’re right, the MAPI property collection must be in sync with the MapiCalendar property values. It looks like some properties were missed. I created a task EMAILNET-40922 to fix this bug.
Thank you.