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

Free Support Forum - aspose.com

Aspose.Email MapiCalender Change Fields


I was trying to enumerate through an Outlook folder and edit emails with an appointment/.ics file.

I was wondering if it is possible to edit the organizer and mailto addresses (attendee.EmailAddress did not seem to work) of an MapiCalender object. Editing the display names, time stamps, and location seemed to work better. Do I need to load or convert it to a different object?

Thanks in advance


During the process of loading an ICS file to MapiCalendar, you get the AlternateView of the Appointment using RequestAppointment method. This gives you the calendar object as MailMessage that you can use to set the From (organizer) and To (attendees) properties of the appointment to achieve your requirements. Please let us know if you have any further query in this regard.

Thank you, I did make some progress with that method. The goal is to actually edit an appointment in a .pst file and then save it back to the file modified.

I had some luck with the method below, but when looking at the .pst file, the current user is thought to be the organizer instead of what was set in the .ics and from header.

Code is attached below. Also, some of the base-64 .ics file fields appeared different when comparing the original to modified, like the cancelled STATUS not carrying over, a UID field not being added, SEQUENCE being changed from 0 to 1. In the original, an extra “cancelled:” was added to the description.

The main issue, however, is that Outlook seems to think the current user is the organizer even with those base-64 fields manually changed to be the original and the From header as well as organizer in meeting set to the same different address.

        foreach (var msg in folder.EnumerateMapiMessages())
            if (msg.MessageClass.Contains("IPM.Schedule"))
                Aspose.Email.Mapi.MapiCalendar calendar = (Aspose.Email.Mapi.MapiCalendar)msg.ToMapiMessageItem();
                calendar.Save(@"C:\temp\PST\msgTemp.ics", Aspose.Email.Calendar.AppointmentSaveFormat.Ics);

                Appointment appt = Appointment.Load(@"C:\temp\PST\msgTemp.ics");
				//modify appointment if desired

                appt.Save(@"C:\temp\PST\msgApptToAdd.ics", AppointmentSaveFormat.Ics);

                MailMessage mailMsg = new MailMessage();


                foreach (string key in msg.Headers.AllKeys)
                    var values = (msg.Headers.GetValues(key));
                    foreach (var value in values)
                        mailMsg.Headers.Add(key, value);
				//Change headers if desired

                MapiMessage mapiMsg = MapiMessage.FromMailMessage(mailMsg);

Also, if there is any simpler way to do it without the conversions and rewriting headers, please advise.


Could you please send us a complete sample code which performs all the steps to re-produce above mentioned issues like difference in fields (STATUS, UID, SEQUENCE and addition of “Cancelled”)? Also send us the source or template PST/.ICS/MSG files which are required to re-produce the scenario. You may also mention the points where we shall observe these problematic properties like in observe in Outlook or watch during debugging along with the snapshots if any. This help us to re-create the exact issue and provide assistance in a timely manner.

Basically, a few different fields should not be too much of a concern for me since it can be manually changed in the .eml files. I would still like to troubleshoot this part, but I believe my larger problem currently is an issue with the organizer. I do not believe I would be able to send my .pst files, but attaching this sample appointment to a new mailmessage and then adding to a .pst results in the organizer looking like it is me when it it set to another email address in the .ics file. The .ics file looks fine when I open it in Outlook, but attaching to a message causes the organizer issue shown in the screenshot. The extra “cancelled:” can also be seen.CalendarOrganizerIssue.zip (12.3 KB)


We are looking into it and will soon update you with our findings.


Thank you for sending the sample data. I have tried to re-produce the issue using attached sample ICS file and code. The output PST file is loaded into Outlook 365 and appointment is opened. Similarly original ICS file is directly opened in Outlook for comparison. I am afraid that no difference is found in Organizer. However, duplication of “Cancelled” is observed. Could you please share the exact problem in organizer field for our analysis here?

Output PST file and comparison image is attached here for your reference.
output.zip (126.8 KB)

So as shown in my capture (in the .zip file), the issue was “As the meeting organizer, you do not need to respond to the meeting” would be shown and it would think I was the organizer despite the from field being set. I am using Office 365 ProPlus.

Also in your output, the original appointment was cancelled with a set time but the added one had the option to be accepted as well as modify all the fields. It does look like the schedule for the day went away as well.


You may please set the unsent flag to false for setting this appointment as sent similar to the original ICS file. Please give it a try and share the feedback. It seems that the only difference which is left is additional “Cancelled” string.

Appointment app = Appointment.Load(path + @"testCalendar.ics");
MailMessage mail = new MailMessage();
MailMessage mailMsg = new MailMessage();
MapiMessage mapiMsg = MapiMessage.FromMailMessage(mailMsg);
mapiMsg.SetMessageFlags(mapiMsg.Flags & ~MapiMessageFlags.MSGFLAG_UNSENT);
mapiMsg.Save(path + "output.msg");
File.Delete(path + @"testCalendar.pst");
PersonalStorage pst = PersonalStorage.Create(path + @"testCalendar.pst", FileFormatVersion.Unicode);
var folder = pst.CreatePredefinedFolder("Calendar", StandardIpmFolder.Appointments);

I tried your code, and the only difference is that I loaded to the Inbox folder so that it would be easier to see the appointment. I do want to modify the original invitation as well as the file stored in the calendar folder.

In the inbox folder, I still get the organizer issue which is my biggest problem right now.

image.png (7.8 KB)


I have observed that saving the draft copy has different behaviour in “Calendar” folder as compared to “Inbox”. In the “Calendar” folder the appointment is in draft mode and no organiser issue is there. On the other hand, when it is copied to Inbox folder, the organiser issue is there and also it is not in draft mode.

It seems to be Outlook behaviour, however to proceed further we need these steps to be performed using Outlook only i.e. no Aspose.Email is involved. Please provide us the steps by performing all the tasks using Outlook only and come up with a output which you want from Aspose.Email as well. Once we get the steps which are performed using Outlook only, we will try to replicate the scenario using Aspose.Email. Send us the output PST as well which you actually want to create using Aspose.Email. It will help us to observe the difference between the two products and and provide assistance in a better way.

We are sorry for the inconvenience in this regard.

Thank you for the help, it seems like the calendar should be in draft mode and that is expected behavior in the calendar folder. I am not sure if I would be able to send a sample .pst file, but it would seem like as of now the organizer issue is the only problem with the desired output.

It is strange that I can open the appointment file outside of Outlook in .eml or .ics format (before I add it to the .pst) and it will not say I am the organizer when it was an email originally sent by another user with that name then changed. When it gets added to the .pst outside of the calendar folder, however, then I have the organizer issue.

I understand that this may be Outlook behavior, but please advise if there is anything else I could potentially do to troubleshoot. Even though I may not be able to send the .pst, I would really just be looking for that test appointment to be added without the organizer issue outside the calendar folder.


I am afraid that we don’t have any other option at this moment. Your assistance is must required to proceed further. We will appreciate if you provide us the PST as mentioned above for our analysis here. We will guide you further once we get the required information.

We are sorry for the inconvenience in this regard.

Alright, here is a sample .pst file along with the code used to create it.

Basically, the desired output of both the calendar and inbox folder would be to be the same as the .eml file I included (except for how in the calendar folder there is the option to modify fields). This file shows the remove from calendar option (because the appointment is cancelled) and does not list me as the organizer because that was set in both the .ics file and the MailMessage.

The .eml file can be opened in its desired form in Outlook and dragged around between folders. I understand that this was not created with Outlook, but in Outlook a cancelled appointment will usually have the option to remove from the calendar and receiving an appointment from someone else will not list me as the organizer. The .eml can even be saved as a .msg file once opened in Outlook (by dragging the file onto the desktop) and does not have those issues.

In the calendar folder, the organizer issue is not there as we determined, but the cancelled status does not seem to carry over even though it was in the .ics file. In the inbox folder, the organizer issue is still there.

Thank you in advance, and I apologize for the delay.

using (var pst = Aspose.Email.Storage.Pst.PersonalStorage.Create(@“C:\temp\PST\CalTest.pst”, 0))
var calendar = pst.CreatePredefinedFolder(“Calendar”, StandardIpmFolder.Appointments);
var inbox = pst.CreatePredefinedFolder(“Inbox”, StandardIpmFolder.Inbox);

                Aspose.Email.Calendar.Appointment appt = Aspose.Email.Calendar.Appointment.Load(@"C:\temp\PST\testCalendar.ics");
                MailMessage msg = new MailMessage();
                msg.Sender = "Organizer, Test <TestOrganizer@test.com>";



                msg.Save(@"C:\temp\PST\testCalendarAsposeLoaded.eml", SaveOptions.DefaultEml);

                Console.WriteLine("Press any key to continue...");

CalendarOutput.zip (26.0 KB)


We are looking into it and will get back to you on this with our findings.


Thank you for providing us details about the issue. It is re-produced here and logged under Id: EMAILNET-39043 for detailed analysis. We will look into this issue on its turn and share the feedback when ready.

The issues you have found earlier (filed as EMAILNET-39043) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by kashif.iqbal