Hello,
I’m using C# with Aspose Email 21.5 to handle items in PST. I found a issue that, if I save some items to Tenf, then load it again, then save it as a MSG, the file is corrupted and cannot be opened.
var ps = PersonalStorage.FromFile(@"{pstname}");
var folders = ps.RootFolder.GetSubFolders();
var calendarFolder = folders.Find(f => f.DisplayName.Equals("Calendar", StringComparison.OrdinalIgnoreCase) || f.DisplayName.Equals("日历", StringComparison.OrdinalIgnoreCase));
var items = calendarFolder.GetContents();
var filter = new List<string>()
{
"FromRoom1ToAdmin",
};
foreach (var i in items)
{
try
{
if (!filter.Contains(i.Subject))
{
continue;
}
var message = ps.ExtractMessage(i.EntryIdString);
var mmmmm = new MemoryStream();
message.SaveAsTnef(mmmmm);
var tnefNew = MapiMessage.LoadFromTnef(mmmmm);
message.Save("F:\\old.msg", SaveOptions.DefaultMsgUnicode);
tnefNew.Save("F:\\new.msg", SaveOptions.DefaultMsgUnicode);
}
catch(Exception ex)
{
}
}
The old one can be opened while the new one will throw an exception when open.
old one:
image.png (23.8 KB)
new one:
image.png (4.0 KB)
Related files have been attached.
room.zip (49.8 KB)
Thanks,