I am creating one PST file and adding one mail in that using the below code:
PersonalStorage PersonalStorageObj = null;
FolderInfo FolderInfoObj;
MailMessage mailmessageObj = null;
MapiMessage mapimessageObj = null;
FolderInfo folderInfoObj = null;
private MapiProperty mapiPropertyObj;
PersonalStorageObj = PersonalStorage.Create(@“c:\temp\test.pst”, FileFormatVersion.Unicode);
folderInfoObj = createAsposeFolder(“Test”);
mailmessageObj = new MailMessage();
mailmessageObj.Subject = “Test Mail”;
mailmessageObj.Body = “TEST”;
MailAddress Fromaddress = new Aspose.Email.MailAddress(“test@gmail.com”, true);
Fromaddress.DisplayName = “Test”;
mailmessageObj.From = Fromaddress;
mapimessageObj = MapiMessage.FromMailMessage(mailmessageObj,
MapiConversionOptions.UnicodeFormat);
MapiProperty ClientSubmitTime = new
MapiProperty(MapiPropertyTag.PR_CLIENT_SUBMIT_TIME,
convertDateTime(DateTime.Today));
mapimessageObj.SetProperty(ClientSubmitTime);
ClientSubmitTime = null;
MapiProperty ReceivedDateTime = new
MapiProperty(MapiPropertyTag.PR_MESSAGE_DELIVERY_TIME,
convertDateTime(DateTime.Today));
mapimessageObj.SetProperty(ReceivedDateTime);
ReceivedDateTime = null;
mapimessageObj.SetMessageFlags(~MapiMessageFlags.MSGFLAG_UNSENT);
folderInfoObj.AddMessage(mapimessageObj);
return true;
It is adding attachment icon and Has attachment property by default.