Set own Date Time for Message in PST

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)

@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)

Dear Support,

How to write Birthday and WeddingAnniversary(Date) in Contacts Field to pst how is possible.

@priyankur.chauhan,

Please use the following code to set Birthday and Anniversary information of a contact.

MapiContact contact = new MapiContact();

contact.Events.Birthday = DateTime.Now;

contact.Events.WeddingAnniversary = DateTime.Now;

Otput.pst.zip (30.5 KB)

Dear Support,

The attached pst file is created by your given sample code and attached file store both emails and the calendars(data).My problem is when i import attached pst file in Microsoft Outlook 2016 version 16.12 then some times show only emails or some time show only calendars.I import attached pst file again and again but only show some times emails or some time show only calendars.but i want when i import attached pst file show both emails and calendars in Microsoft Outlook 2016 version 16.12.

@priyankur.chauhan

The PST file shared is not showing inbox folder after import in Outlook. We have created a sample PST including inbox and calendar items using the following code sampleTestPST.zip (23.8 KB). Please check if it works at your end.
Moreover, please share your code sample for further investigation.

public static void Run()
{
    string dataDir = RunExamples.GetDataDir_Outlook();
    string dst = dataDir + "TestPST.pst";
    PersonalStorage pst = PersonalStorage.Create(dst, FileFormatVersion.Unicode);

    // Add new folder "Inbox"
    pst.RootFolder.AddSubFolder("MyInbox");
    FolderInfo inboxFolder = pst.RootFolder.GetSubFolder("MyInbox");

    // Add some messages to "Inbox" folder
    inboxFolder.AddMessage(MapiMessage.FromFile(RunExamples.GetDataDir_Outlook() + "MapiMsgWithPoll.msg"));

    // Create three Contacts 
    MapiContact contact1 = new MapiContact("Sebastian Wright", "SebastianWright@dayrep.com");
    MapiContact contact2 = new MapiContact("Wichert Kroos", "WichertKroos@teleworm.us", "Grade A Investment");
    contact2.Events.Birthday = DateTime.Now;
    contact2.Events.WeddingAnniversary = DateTime.Now;

    MapiContact contact3 = new MapiContact("Christoffer van de Meeberg", "ChristoffervandeMeeberg@teleworm.us", "Krauses Sofa Factory", "046-630-4614046-630-4614");
    contact3.Events.Birthday = DateTime.Now;
    contact3.Events.WeddingAnniversary = DateTime.Now;

    FolderInfo contactFolder = pst.CreatePredefinedFolder("MyContacts", StandardIpmFolder.Contacts);
    contactFolder.AddMapiMessageItem(contact1);
    contactFolder.AddMapiMessageItem(contact2);
    contactFolder.AddMapiMessageItem(contact3);

    //Adding Calendar Items
    MapiCalendar appointment = new MapiCalendar(
        "LAKE ARGYLE WA 6743",
        "Appointment",
        "This is a very important meeting :)",
        new DateTime(2012, 10, 2, 13, 0, 0),
        new DateTime(2012, 10, 2, 14, 0, 0));

    // Create the meeting
    MapiRecipientCollection attendees = new MapiRecipientCollection();
    attendees.Add("ReneeAJones@armyspy.com", "Renee A. Jones", MapiRecipientType.MAPI_TO);
    attendees.Add("SzllsyLiza@dayrep.com", "Szollosy Liza", MapiRecipientType.MAPI_TO);

    MapiCalendar meeting = new MapiCalendar(
        "Meeting Room 3 at Office Headquarters",
        "Meeting",
        "Please confirm your availability.",
        new DateTime(2012, 10, 2, 13, 0, 0),
        new DateTime(2012, 10, 2, 14, 0, 0),
        "CharlieKhan@dayrep.com",
        attendees
        );

    FolderInfo calendarFolder = pst.CreatePredefinedFolder("MyCalendar", StandardIpmFolder.Appointments);
    calendarFolder.AddMapiMessageItem(appointment);
    calendarFolder.AddMapiMessageItem(meeting);
}

Dear Support,

I am not avail to download TestPST.zip file when i click TestPST.zip file then show this message Sorry, this file is private. Only visible to topic owner and staff members.

@priyankur.chauhan

Please find the PST file on this link:
https://www.dropbox.com/s/uf9h8wi7bykd2fu/TestPST.zip?dl=0

Dear Support,

I import shared TestPST file first time then only the e-mail is import the calendar is not import. I import shared TestPST file again and again only show some times emails or some time show only calendars.my main concern is import shared TestPST file then show only one email or calendar.if e-mail is import then calendar is not show. if calendar is import then e-mail is not show in Microsoft Outlook 2016 version 16.12…

The attached screen short is show this case.
I import shared TestPST file first time then only show the e-mail is import the calendar is not import.
Screen Shot 2018-09-20 at 1.28.34 PM.png (85.8 KB)
Screen Shot 2018-09-20 at 1.28.53 PM.png (85.2 KB)

@priyankur.chauhan

We have logged this issue under issue ID “EMAILJAVA-34427” for further investigation with Outlook 2016 version 16.12. You will automatically be updated here once we have more information to share.

Dear Support,

The following issue ID “EMAILJAVA-34427” is solve or not in Aspose.Email for .Net(Library).

@priyankur.chauhan

The folder creation ordering for PST is important. So please try creating MyCalendar folder before MyContacts.

FolderInfo inboxFolder = pst.CreatePredefinedFolder("MyInbox", StandardIpmFolder.Inbox);
FolderInfo calendarFolder = pst.CreatePredefinedFolder("MyCalendar", StandardIpmFolder.Appointments);
FolderInfo contactFolder = pst.CreatePredefinedFolder("MyContacts", StandardIpmFolder.Contacts);