Hi,
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();
msg.AddAlternateView(appointment.RequestApointment());
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