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

Free Support Forum - aspose.com

Messages differ after saving and loading Tnef

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>()
    foreach (var i in items)
           if (!filter.Contains(i.Subject))
           var message = ps.ExtractMessage(i.EntryIdString);
           var mmmmm = new MemoryStream();
           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)


Thank you for the issue description. I reproduced the problem and logged the issue with ID EMAILNET-40291 in our tracking system. Our development team will investigate this case. You will be notified when it is fixed.

The issues you have found earlier (filed as EMAILNET-40291) have been fixed in this update.