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

Free Support Forum - aspose.com

Outlook 2013 No Date on Draft Created by Aspose.Email

I use the following code to create draft messages in a PST file. However when the draft is viewed in Outlook 2013 no create date is displayed (see attachment). Any ideas on how to set the date?


Code:

Dim Pst As Aspose.Email.Outlook.Pst.PersonalStorage = Aspose.Email.Outlook.Pst.PersonalStorage.FromFile("\x\x\x\x.pst")
Dim Drafts As Aspose.Email.Outlook.Pst.FolderInfo = Pst.RootFolder.GetSubFolder(“Drafts”)

Dim Msg As New Aspose.Email.Outlook.MapiMessage()
Msg.Recipients.Add(LCInfo(“x”), LCInfo(“x”), Aspose.Email.Outlook.MapiRecipientType.MAPI_TO)
Msg.Subject = NotifyInfo(“EMAIL_SUBJECT”)
Msg.SetBodyContent(GetHtml(NotifyInfo(“x”)), Aspose.Email.Outlook.BodyContentType.Html)
Msg.Attachments.Add(LCInfo(“x”) & Now.Month & Now.Day & Now.Year & Now.Hour & Now.Minute & Now.Second & “.xlsx”, CreateXlsx(x, NotificationControlId).GetAsByteArray)
Msg.DeliveryTime = Now
Msg.ClientSubmitTime = Msg.DeliveryTime
Msg.SetMessageFlags(Aspose.Email.Outlook.MapiMessageFlags.MSGFLAG_UNSENT Or Aspose.Email.Outlook.MapiMessageFlags.MSGFLAG_FROMME)


Drafts.AddMessage(Msg)

Pst.Dispose()

Found a fix:


Dim Pst As Aspose.Email.Outlook.Pst.PersonalStorage = Aspose.Email.Outlook.Pst.PersonalStorage.FromFile("\mfrfile\common\hilimirew\Test.pst")
Dim Drafts As Aspose.Email.Outlook.Pst.FolderInfo = Pst.RootFolder.GetSubFolder(“Drafts”)

Dim Msg As New Aspose.Email.Outlook.MapiMessage()


Dim Prop3 As New Aspose.Email.Outlook.MapiProperty(Aspose.Email.Outlook.MapiPropertyTag.PR_CREATION_TIME, convertDateTime(Now))
Msg.SetProperty(Prop3)


Private Shared Function convertDateTime(t As DateTime) As Byte()
Dim filetime As Long = t.ToFileTime()
Dim d As Byte() = New Byte(7) {}
d(0) = CByte(filetime And &HFF)
d(1) = CByte((filetime And &HFF00) >> 8)
d(2) = CByte((filetime And &HFF0000) >> 16)
d(3) = CByte((filetime And &HFF000000UI) >> 24)
d(4) = CByte((filetime And &HFF00000000L) >> 32)
d(5) = CByte((filetime And &HFF0000000000L) >> 40)
d(6) = CByte((filetime And &HFF000000000000L) >> 48)
d(7) = CByte((CULng(filetime) And &HFF00000000000000UL) >> 56)
Return d
End Function

Hi Wilford,

Thank you for writing to Aspose support team.

PR_CREATION_TIME is the right property you were looking for. Please let us know if we can be of any additional help to you in this regard.