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

Free Support Forum - aspose.com

Ics to Msg conversion


please I’d need help
I’m using following code to convert an ics file to msg

public static byte[] IcsToMsg(byte[] ics)
using (var icsMemoryStream = new MemoryStream(ics))
var appointment = Appointment.Load(icsMemoryStream);
var msg = new MailMessage();

using (var msgMemoryStream = new MemoryStream())
var mapiMessage = MapiMessage.FromMailMessage(msg);
var cal = (MapiCalendar)mapiMessage.ToMapiMessageItem();
cal.Save(msgMemoryStream, AppointmentSaveFormat.Msg);
return msgMemoryStream.ToArray();

but at this line var mapiMessage = MapiMessage.FromMailMessage(msg); I’m getting this error:
Specified argument was out of the range of valid values.
Parameter name: The value should be from -31 to -1 or from 1 to 31 Rule part ‘BYMONTHDAY = 0’

at Aspose.iCalendar.RecurrenceRule. (String[] , String )
at Aspose.iCalendar.RecurrenceRule. (String )
at Aspose.iCalendar.RecurrenceRule.FromiCalendar(String )
at . . (MapiCalendarRecurrencePattern , DateTime , DateTime )
at . . ( )
at Aspose.Email.Outlook.MapiMessage. ( , OutlookMessageFormat , String )
at Aspose.Email.Outlook.MapiMessage. (MailMessage , OutlookMessageFormat , Boolean )
at Aspose.Email.Outlook.MapiMessage.FromMailMessage(MailMessage message, MapiConversionOptions options)
at Aspose.Email.Outlook.MapiMessage.FromMailMessage(MailMessage message)

I attached problematic ics file to the post… Am I doing something wrong? Other ics calendar files with recurrence are converted with no problem

Hi Ivan,

Thank you for posting your inquiry.

I was able to reproduce the issue at our end using the latest version of Aspose.Email for .NET 5.7.0. It has been logged as EMAILNET-34989 in our bug tracking system for further investigation by our product team. We shall share the update with you here once there is some information available about this problem.

Thank you very much fo the quick response.

I’m looking forward to update


You are welcome. We shall notify you here as soon as there is some information available about this problem.