In issue https://forum.aspose.com/t/unable-to-manually-create-a-new-folder-via-outlook-for-a-pst-generated-by-aspose-email/190540/6
I had commented that an email is not rendered correctly when I make use of MapiConversionOptions. You had replied that I need to set MapiMessageFlags.MSGFLAG_HASATTACH to true.
Despite setting the flag does fix the rendering issue, I do not think that just because I am making use of the MapiConversionOptions factory overload I have to now take care of setting the MSGFLAG_HASATTACH. This is an inconsistency is your API and I consider the solution you gave me as a workaround. From a developer perspective I treat this a bug in your SDK. If for example I make use of the MapiConversionOptions.UnicodeFormat, there should be no reason why this should change the behavior of the MSGFLAG_HASATTACH.
What other differences do I need to take care of if I change my method from
var mapiItem = MapiMessage.FromMailMessage(mailMessage);
to
var mapiItem = MapiMessage.FromMailMessage(mailMessage, MapiConversionOptions.UnicodeFormat);
Additionally what is the correct way of handling MSGFLAG_HASATTACH. The below is my workaround
using (var memoryStream = new MemoryStream(mailboxItem.MimeContentBytes))
using (var mailMessage = MailMessage.Load(memoryStream))
using (var mapiItem = MapiMessage.FromMailMessage(mailMessage, MapiConversionOptions.UnicodeFormat))
{
var messageFlags = MapiMessageFlags.MSGFLAG_READ;
if (mailMessage.Attachments.Any() || mailMessage.LinkedResources.Any())
{
messageFlags = messageFlags | MapiMessageFlags.MSGFLAG_HASATTACH;
}
}
Do you suggest something different?