I am trying to save an Outllok meeting ics file as an Outlook appointment ics but when i use do SaveAs to a folder location, it is saving as a meeting.
I have the following code but I can not seem to locate the issue. When I use .Display it shows as an appointment but .SaveAs is saving back as a meeting with recipients.
Any help is much appreciated
Outlook.Application App = new Outlook.Application();
string FPath = @"C:\\Documents\TestMeeting.ics"
var item = App.Session.OpenSharedItem(FPath) as Outlook.MeetingItem;
var AppointmentItem = item.GetAsssociatedAppointment(false);
AppointmentItem.MeetingStatus = Outlook.OlMeetingStatus.olNonMeeting;
AppointmentItem.Display(true);
AppointmentItem.SaveAs(@"C:\\Documents\TestAppointment1.ics",Outlook.OlSaveAsType.olIcal);
Use the Save
method to save the just opened meeting into your calendar:
string FPath = @"C:\\Documents\TestMeeting.ics"
var item = App.Session.OpenSharedItem(FPath) as Outlook.MeetingItem;
item.Save();
// only after that you can try reprieving the associated appointment
var AppointmentItem = item.GetAsssociatedAppointment(false);
Also I'd recommend creating a new appointment item from scratch and then saving it to the disk.