Hi,
I have to create calendar from MapiCalendar Object. So i have to set Creation Time, Recieve Time , Sent Time , to MapiCalendar Object. Please provide me some sample code.
Please give a try to following sample code and share the feedback.
private static byte [] convertDateTime(DateTime t)
{
long filetime = t.toFileTime();
byte[] d = new byte[8];
d[0] = (byte)(filetime & 0xFF);
d[1] = (byte)((filetime & 0xFF00) >> 8);
d[2] = (byte)((filetime & 0xFF0000) >> 16);
d[3] = (byte)((filetime & 0xFF000000) >> 24);
d[4] = (byte)((filetime & 0xFF00000000l) >> 32);
d[5] = (byte)((filetime & 0xFF0000000000l) >> 40);
d[6] = (byte)((filetime & 0xFF000000000000l) >> 48);
d[7] = (byte)((filetime & 0xFF00000000000000l) >> 56);
return d;
}
private static void testEmail3()
{
MapiCalendar cal = new MapiCalendar();
MapiProperty property = new MapiProperty(MapiPropertyTag.PR_CREATION_TIME, convertDateTime(new DateTime(2018, 1, 1)));
cal.setProperty(property);
property = new MapiProperty(MapiPropertyTag.PR_RECEIPT_TIME, convertDateTime(new DateTime(2018, 1, 1)));
cal.setProperty(property);
property = new MapiProperty(MapiPropertyTag.PR_DELIVER_TIME, convertDateTime(new DateTime(2018, 1, 1)));
cal.setProperty(property);
}