The attached MSG calendar invitation opens in Outlook, but causes an exception in Aspose.Email 19.5 for .NET with the following code: input.zip (14.4 KB)
var message = Aspose.Email.Mapi.MapiMessage.FromFile("input.msg");
var saveOpts = new Aspose.Email.MhtSaveOptions();
saveOpts.MhtFormatOptions = Aspose.Email.MhtFormatOptions.RenderCalendarEvent | Aspose.Email.MhtFormatOptions.WriteHeader;
message.Save("output.mhtml", saveOpts);
The exception is:
System.ArgumentNullException
HResult=0x80004003
Message=Value cannot be null.
Parameter name: value
Source=mscorlib
StackTrace:
at System.String.IndexOf(String value, Int32 startIndex, Int32 count, StringComparison comparisonType)
at #=zfAI7bgSi9_djzK8FUMhyEZwR06kD.#=zQBoS0N2CR230(#=zb3OORIwMuvyO8vTqxT9567vJHOTF_Jzc2w== #=zXakRuCwd$96n)
at #=zfAI7bgSi9_djzK8FUMhyEZwR06kD.#=zNj$6G1rfxWr0(#=zpmyqBzD_IM1jr4lXvYLDfK8GIi$v #=zUdHVFZ4DoRSt3sXvLg==, MailMessage #=zN9TkzmE=)
at #=zfAI7bgSi9_djzK8FUMhyEZwR06kD.#=zCFT_vb4iW8GP(MailMessage #=zN9TkzmE=, MhtFormatOptions #=zfmo4h9Q=)
at #=zfAI7bgSi9_djzK8FUMhyEZwR06kD.#=zlnovW$s=(MailMessage #=zdmlwxbQ=, MhtFormatOptions #=zSMcH6TNhMICr)
at Aspose.Email.MailMessage.#=z2hB3MYs2nJ5f(MhtSaveOptions #=zGj$sPTPL_72O)
at Aspose.Email.MailMessage.Save(Stream stream, SaveOptions options)
at Aspose.Email.Mapi.MapiMessage.Save(Stream stream, SaveOptions options)
at Aspose.Email.Mapi.MapiMessage.Save(String fileName, SaveOptions options)
If I remove the 3rd line (saveOpts.MhtFormatOptions = Aspose.Email.MhtFormatOptions.RenderCalendarEvent | Aspose.Email.MhtFormatOptions.WriteHeader) it does not throw an exception, but then the MHTML file excludes the appointment information.
I want to be able to convert it to MHTML as a calendar event. Can you please advise if this is a bug in Aspose.Email and if so can it please be fixed, or otherwise how to avoid the exception?
Thank you!