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

Free Support Forum - aspose.com

Issue after adding Mapi property to MapiMessage


We are using Aspose.Email.dll version we are facing issue after adding Mapi Property
Following are sample id and its value which casing problem

Mapi ID

Here is Code we using

MapiMessage pMail = null;
MailMessage Obj_MailMessage = null;
Obj_MailMessage = MailMessage.Load(MsgPath, MessageFormat.Msg);
pMail = MapiMessage.FromMailMessage(Obj_MailMessage, OutlookMessageFormat.Unicode);

After setting this property sender Email address and To Address are not coming properly

we are sending Sample MSG file and Output PST file plz see the attachment.


Hi Rohidas,

Thank you for contacting Aspose support team.

I have analyzed your requirement and following is a sample code which adds required properties to message and saves this message to PST. If we open this PST in Outlook, To and From fields are displayed properly. Could you please give it a try and let us know your feedback?

MapiMessage pMail = null;
MailMessage Obj_MailMessage = null;
string MsgPath = @“D:\Aspose\TestMapiProperty\MSGSample\Message02.msg”;
MailMessageLoadOptions loadOptions = new MailMessageLoadOptions();
loadOptions.MessageFormat = MessageFormat.Msg;
Obj_MailMessage = MailMessage.Load(MsgPath, loadOptions);
pMail = MapiMessage.FromMailMessage(Obj_MailMessage,OutlookMessageFormat.Unicode);

PersonalStorage pst = PersonalStorage.Create(@“D:\Aspose\TestMapiProperty\MSGSample\pstFile.pst”, FileFormatVersion.Unicode);
FolderInfo outfolder = pst.RootFolder.GetSubFolder(“TestFolder”);

Encoding f_objEncoding = Encoding.Unicode;
string propValue = "sohail1@systoolsgroup.com";
MapiProperty mapiProperty = new MapiProperty(MapiPropertyTag.PR_DISPLAY_TO, f_objEncoding.GetBytes(propValue));
pMail.Properties.Add(MapiPropertyTag.PR_DISPLAY_TO, mapiProperty);

propValue = “ScienceDaily”;
mapiProperty = new MapiProperty(MapiPropertyTag.PR_SENDER_NAME, f_objEncoding.GetBytes(propValue));
pMail.Properties.Add(MapiPropertyTag.PR_SENDER_NAME, mapiProperty);