Dear support,
I used your given sample code
public static void Test()
{
DataTable table = GetTable();
File.Delete(“output.pst”);
PersonalStorage pst = PersonalStorage.Create(“output.pst”, FileFormatVersion.Unicode);
FolderInfo info = pst.CreatePredefinedFolder(“Inbox”, StandardIpmFolder.Inbox);
for (int i = 0; i < table.Rows.Count; i++)
{
MapiMessage mapi = new MapiMessage(
"from@gmail.com",
table.Rows[i][“To”].ToString(),
table.Rows[i][“Subject”].ToString(),
table.Rows[i][“MsgBody”].ToString()
);
mapi.Recipients.Add(table.Rows[i][“CCAddress”].ToString(), table.Rows[i][“CCDisplayName”].ToString(), MapiRecipientType.MAPI_CC);
mapi.Attachments.Add(table.Rows[i][“AttachmentName”].ToString(), table.Rows[i][“AttachmentData”] as Byte[]);
info.AddMessage(mapi);
}
pst.Dispose();
}
public static DataTable GetTable()
{
DataTable table = new DataTable();
table.Columns.Add(“Subject”, typeof(string));
table.Columns.Add(“To”, typeof(string));
table.Columns.Add(“MsgBody”, typeof(string));
table.Columns.Add(“CCDisplayName”, typeof(string));
table.Columns.Add(“CCAddress”, typeof(string));
table.Columns.Add(“AttachmentName”, typeof(string));
table.Columns.Add(“AttachmentData”, typeof(Byte[]));
// Here we add five DataRows.
table.Rows.Add("Subject 1", "to1@gmail.com", "Message Body 1", "CC1", "CC1@gmail.com", "att1.txt", Encoding.ASCII.GetBytes("Data in att1 file"));
table.Rows.Add("Subject 2", "to2@gmail.com", "Message Body 2", "CC2", "CC2@gmail.com", "att2.txt", Encoding.ASCII.GetBytes("Data in att2 file"));
table.Rows.Add("Subject 3", "to3@gmail.com", "Message Body 3", "CC3", "CC3@gmail.com", "att3.txt", Encoding.ASCII.GetBytes("Data in att3 file"));
table.Rows.Add("Subject 4", "to4@gmail.com", "Message Body 4", "CC4", "CC4@gmail.com", "att4.txt", Encoding.ASCII.GetBytes("Data in att4 file"));
table.Rows.Add("Subject 5", "to5@gmail.com", "Message Body 5", "CC5", "CC5@gmail.com", "att5.txt", Encoding.ASCII.GetBytes("Data in att5 file"));
return table;
}
I want to know how to write the own date and time for mail in pst file.currently your given sample code write present date and time.how is possible to write own date and time in pst file.