Set own Date Time for Message in PST


#1

Dear support,

How to write own date and time with day in pst. I also using your given sample code but when i import converted pst in outlook 2016 than show present date and time(converted pst date and time).

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);
}

How is possible to write own date and time in pst.the attached screenshort show the present date but i set convertDateTime(new DateTime(2018, 1, 1) in this function.how to change it.
Screen Shot 2018-07-10 at 1.26.25 PM.png (51.4 KB)
Screen Shot 2018-07-10 at 1.27.43 PM.png (86.9 KB)


#2

@priyankur.chauhan,

We have tested this at our end with the latest version of the API and the dates do preserve with the message item added to the PST. Only the Creation Date changes which is expected behavior when a new item is added to Outlook as well in unsent form. Output PST generated with latest version of API is attached here for your reference. 168953.zip (12.0 KB)