Hi
I using aspose 3.5 dll . I am setting few property by addpropertybyTag.
if i set some property then it will not shows the any attachments.
if (Path.GetExtension(f_tmpEmlPath).ToLower() == “.eml”)
{
f_Objmailmessage = MailMessage.Load(f_tmpEmlPath, MessageFormat.Eml);
}
}
f_mapimessage = MapiMessage.FromMailMessage(MailMessage.Load(f_tmpEmlPath, MessageFormat.Eml), OutlookMessageFormat.Unicode);
addByPropertyTag(ref f_mapimessage, p_sysEmail, true);
}
addByPropertyTag(ref f_mapimessage, p_sysEmail, true)
{
try
{
if (p_Messageobj != null && String.IsNullOrEmpty(p_Messageobj.Subject))
{
if (!String.IsNullOrEmpty(p_sysEmail.Subject))
{
f_MapiProperty = new MapiProperty
(MapiPropertyTag.PR_SUBJECT,
f_objEncoding.GetBytes(p_sysEmail.Subject));
p_Messageobj.SetProperty(f_MapiProperty);
f_MapiProperty = null;
}
}
}
catch (Exception ex) { }
}
Hi Maruti,
Hi
If i set the unread property then it not display the attachment.
static void TestUnicode()
{
MapiMessage f_mapimessage = null;
PersonalStorage pst = PersonalStorage.Create(@“TestSubject.pst”, FileFormatVersion.Unicode);
FolderInfo f_FolderInfoObj = pst.RootFolder.AddSubFolder(“TestFolder”);
MailMessage p_Messageobj= MailMessage.Load(@“1.eml”, MessageFormat.Eml);
f_mapimessage = MapiMessage.FromMailMessage(p_Messageobj, OutlookMessageFormat.Unicode);
Mail mail=new Mail();
try
{
MapiProperty f_MapiProperty = null;
Encoding f_objEncoding = Encoding.Unicode;
if (!String.IsNullOrEmpty(“This is dummy subject.”))
{
f_MapiProperty = new MapiProperty
(MapiPropertyTag.PR_SUBJECT,
f_objEncoding.GetBytes(“This is dummy subject.”));
f_mapimessage.SetProperty(f_MapiProperty);
f_MapiProperty = null;
}
if (false)
f_mapimessage.SetMessageFlags((f_mapimessage.Flags & ~MapiMessageFlags.MSGFLAG_READ));
else
f_mapimessage.SetMessageFlags((f_mapimessage.Flags & MapiMessageFlags.MSGFLAG_READ));
}
catch (Exception ex) { }
f_FolderInfoObj.AddMessage(f_mapimessage);
pst.Dispose();
}
Hi Maruti,
I have tested this issue with latest version of Aspose.Email for .NET 3.6.0 and the following code sample which has nothing changed in it except some compilation errors removed. The created output PST contains the message in unread form and the attachments are also displayed fine in this PST. Please try it with the latest version of Aspose.Email for .NET and let us know your feedback.
Sample code:
string dir = "EMAIL_514594";
File.Delete(dir + "TestSubject.pst");
MapiMessage f_mapimessage = null;
PersonalStorage pst = PersonalStorage.Create(dir + @"TestSubject.pst", FileFormatVersion.Unicode);
FolderInfo f_FolderInfoObj = pst.RootFolder.AddSubFolder("TestFolder");
MailMessage p_Messageobj = MailMessage.Load(dir + @"att.eml");
f_mapimessage = MapiMessage.FromMailMessage(p_Messageobj, OutlookMessageFormat.Unicode);
try
{
MapiProperty f_MapiProperty = null;
Encoding f_objEncoding = Encoding.Unicode;
if (!String.IsNullOrEmpty("This is dummy subject."))
{
f_MapiProperty = new MapiProperty(MapiPropertyTag.PR_SUBJECT, f_objEncoding.GetBytes("This is dummy subject."));
f_mapimessage.SetProperty(f_MapiProperty);
f_MapiProperty = null;
}
//Set IsRead flag to true
f_mapimessage.SetMessageFlags((f_mapimessage.Flags | MapiMessageFlags.MSGFLAG_READ));
}
catch (Exception ex) { }
f_FolderInfoObj.AddMessage(f_mapimessage);
pst.Dispose();
Hi
we get issue if we set the read property only. If mail is unread and if we set read property true then we will gate that issue. please change following code you will get issue. or you can connect to my machine via TeamViewer. I will give you remote access.
static void TestUnicode()
{
MapiMessage f_mapimessage = null;
PersonalStorage pst = PersonalStorage.Create(@“TestSubject.pst”, FileFormatVersion.Unicode);
FolderInfo f_FolderInfoObj = pst.RootFolder.AddSubFolder(“TestFolder”);
MailMessage p_Messageobj= MailMessage.Load(@“1.eml”, MessageFormat.Eml);
f_mapimessage = MapiMessage.FromMailMessage(p_Messageobj, OutlookMessageFormat.Unicode);
Mail mail=new Mail();
try
{
MapiProperty f_MapiProperty = null;
Encoding f_objEncoding = Encoding.Unicode;
if (!String.IsNullOrEmpty(“This is dummy subject.”))
{
f_MapiProperty = new MapiProperty
(MapiPropertyTag.PR_SUBJECT,
f_objEncoding.GetBytes(“This is dummy subject.”));
f_mapimessage.SetProperty(f_MapiProperty);
f_MapiProperty = null;
}
f_mapimessage.SetMessageFlags((f_mapimessage.Flags & MapiMessageFlags.MSGFLAG_READ));
}
catch (Exception ex) { }
f_FolderInfoObj.AddMessage(f_mapimessage);
pst.Dispose();
}
Hi Maruti,
Hi
Thank you For giving me asap reply.
By using operator “|” (OR) it is working.
But i have few question
1) When should we use the operator “&”.
2) When should we use the operator “|”.
3) if “&” is not working for read property then how it works with unread property.
4)Why operator “&” is working with 3.2 dll for read property also.
Thank you
4)Why operator "&" is working with 3.2 dll for read property also.