Thorben
Thorben

Reputation: 11

C# -> COM -> change appointment -> exception when filling Start and End -> The object does not support this method

i want to change an existing appointment. For this i search the existing appointment via:

                Outlook.Items foundItems = outlookItems.Restrict(filter);

            if (foundItems != null)
            {
                foreach (var item in foundItems)
                {
                    if (item is Outlook.AppointmentItem)
                    {
                        Outlook.AppointmentItem aptItem = item as Outlook.AppointmentItem;

                        aptItem.Start = start;
                    }
                }
            }

or:

foundItem = outlookItems.Find(filter) as Outlook.AppointmentItem;
if (foundItem != null)
{foundItem.Start = start}

In any case, if i want to fill the appoitnment.Start property, it runs into this exception:

"The object does not support this method."

My thoughts were that it was a meeting, so I tried the following:

                Outlook.MeetingItem foundItem = outlookItems.Find(filter) as Outlook.MeetingItem;

            Outlook.AppointmentItem aptItem = foundItem.GetAssociatedAppointment(false);

But the foundItem was null, also no MeetingItem...

Does anyone have an idea?

Upvotes: 0

Views: 113

Answers (1)

Thorben
Thorben

Reputation: 11

Okay, i found a solution by my selfe:

In case of an recurring appointment or meeting, i fill the properties StartTime and EndTime from the recurrencePattern:

                            newRecurrencePatternForOutlook.StartTime = start;
                        newRecurrencePatternForOutlook.EndTime = end;

But why the Start and End Property of the AppointmentItem does not exist, I cannot answer.

Maybe this will help someone

Upvotes: 1

Related Questions