C#->;COM->;更改任命->;填充开始和结束时出现异常->;对象不支持此方法

C#->;COM->;更改任命->;填充开始和结束时出现异常->;对象不支持此方法,c#,outlook,com,outlook-object-model,C#,Outlook,Com,Outlook Object Model,我想更改现有的约会。为此,我通过以下方式搜索现有约会: Outlook.Items foundItems = outlookItems.Restrict(filter); if (foundItems != null) { foreach (var item in foundItems) { if (item i

我想更改现有的约会。为此,我通过以下方式搜索现有约会:

                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;
                    }
                }
            }
或:

在任何情况下,如果要填充Appointment.Start属性,它会遇到以下异常:

“对象不支持此方法。”

我的想法是这是一次会议,因此我尝试了以下方法:

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

            Outlook.AppointmentItem aptItem = foundItem.GetAssociatedAppointment(false);
但是foundItem为null,也没有MeetingItem


有人有想法吗?

好的,我自己找到了一个解决方案:

在定期约会或会议的情况下,我根据定期模式填写属性StartTimeEndTime

                            newRecurrencePatternForOutlook.StartTime = start;
                        newRecurrencePatternForOutlook.EndTime = end;
但是为什么AppointItem的开始和结束属性不存在,我无法回答


也许这会帮助某人

您的代码搜索的是哪个文件夹?您好,Dimitry,我使用日历文件夹:
ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar)
Update:此选项仅在定期约会时发生supdate 2:此属性也会发生此错误:AllDayEvent
                            newRecurrencePatternForOutlook.StartTime = start;
                        newRecurrencePatternForOutlook.EndTime = end;