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

Free Support Forum - aspose.com


I am new to the forum, and have a question in regards to an IPM.Appointment. I am able to utilize the IEWS client and render a calendar appointment as illustrated here:

NetworkCredential credentials = new NetworkCredential(username, password, domain);
            IEWSClient client = EWSClient.GetEWSClient(mailboxUri, credentials);
            //                      client.ImpersonateUser(ItemChoice.SmtpAddress, "");
            Console.Write("Calendar of User = " + client.MailboxInfo.CalendarUri);
            Console.Write("mapiMess.MessageClass = " + mapiMess.MessageClass);

            MapiCalendar cal = (MapiCalendar)mapiMess.ToMapiMessageItem();

            // check for recipient
            if (cal.Recipients.Count > 0)

                MemoryStream ms = new MemoryStream();


                ms.Position = 0;

                Aspose.Email.Calendar.Appointment app = Aspose.Email.Calendar.Appointment.Load(ms);
                app.Method = AppointmentMethodType.Publish;


however, when I attempt to utilize Microsoft Web Services (for safe threading), I run into issues; as all appears well, however it throws an exception on the “for each” that the Collection was modified", and furthermore nothing is save to the calendar. The new code is below, any assistance would be appreciated.

MailMessage mail = mapiMess.ToMailMessage(new MailConversionOptions());  
            foreach (AlternateView view in mail.AlternateViews)

                if (view.ContentType.ToString().Contains("text/calendar") == true)

                    Microsoft.Exchange.WebServices.Data.EmailMessage email = new Microsoft.Exchange.WebServices.Data.EmailMessage(service);

                    Stream myMSCal = view.ContentStream;


                    Aspose.Email.Calendar.Appointment calDoc = Aspose.Email.Calendar.Appointment.Load(myMSCal);
                    calDoc.Method = AppointmentMethodType.Publish;

                    MapiMessage calMapiMsg = MapiMessage.FromMailMessage(mail);

                    MapiCalendar mapiCal = (MapiCalendar)calMapiMsg.ToMapiMessageItem();

                    MemoryStream myMSAppt = new MemoryStream();
                    myMSAppt.Position = 0;

                    mail.Save(myMSAppt, SaveOptions.DefaultEml);
                    email.MimeContent = new MimeContent("UTF-8", myMSAppt.ToArray());

                    email.Save(new FolderId(WellKnownFolderName.Calendar, new Mailbox("")));


Have you tried this with the latest version of the API? If it still creates problem, please share your sample input MSG file with us for our reference and further investigation.