The object does not support this method, when updating recurring appointment in Outlook

543 views Asked by At

I'm having an issue updating a recurring Appointment using Outlook's API. I keep receiving a COMException stating,

System.Runtime.InteropServices.COMException (0x90720009): The object does not support this method.
at Microsoft.Office.Interop.Outlook._AppointmentItem.set_Start(DateTime Start)
at Outlook_Calendar_Sync.CalendarItem.GetOutlookAppointment(AppointmentItem item) in D:\Documents\Visual Studio 2015\Projects\Outlook-Calendar-Sync\Outlook Calendar Sync\CalendarItem.cs:line 228

I've verified that it is an actual AppointmentItem interface yet I still get this error. Any help would be greatly appreciated. Here is the code I'm using to try to update the AppointmentItem.

Log.Write( $"Updating recurring Outlook appointment, {ev.Subject}" );
                // Create the filter to find the event. This is done by either the subject and start date or the ID
                var filter = ( ev.Action.HasFlag( CalendarItemAction.GeneratedId ) )
                    ? ( "[Subject]='" + ev.Subject + "'" )
                    : "[ID] = '" + ev.ID + "'";

                var appointmentItems = m_folder.Items.Restrict( filter );
                foreach ( AppointmentItem appointmentItem in appointmentItems )
                {
                    if ( appointmentItem.RecurrenceState != OlRecurrenceState.olApptMaster )
                        continue;

                    appointmentItem.GetRecurrencePattern();
                    ev.GetOutlookAppointment( appointmentItem );
                    appointmentItem.Save();

                    ev.Action &= ~CalendarItemAction.GeneratedId;
                    ev.Action &= ~CalendarItemAction.OutlookUpdate;
                }

In the ev.GetOutlookAppointment( appointmentItem ) I convert my internal storage class into an Outlook AppointmentItem interface.

This is the start of that method:

        public AppointmentItem GetOutlookAppointment( AppointmentItem item ) {
        try
        {
            item.Start = DateTime.Parse( Start );
            item.End = DateTime.Parse( End );

The COMException gets thrown when trying to change the item.Start DateTime.

0

There are 0 answers