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

Free Support Forum - aspose.com

Issue after adding Mapi property to MapiMessage

Hi


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

Mapi ID
203030558
235143198

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);
pMail.SetProperty(newMapiProperty(ID,BitConverter.GetBytes(((Convert.ToInt64(value.ToString()))))));



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.



Regards
Rohidas




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

File.Delete(@“D:\Aspose\TestMapiProperty\MSGSample\pstFile.pst”);
PersonalStorage pst = PersonalStorage.Create(@“D:\Aspose\TestMapiProperty\MSGSample\pstFile.pst”, FileFormatVersion.Unicode);
pst.RootFolder.AddSubFolder(“TestFolder”);
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);

outfolder.AddMessage(pMail);