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

问题描述

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

ohmyzsh

或:

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

无论如何,如果我想填充appoitnment.Start属性,它将遇到此异常:

“对象不支持方法。”

我以为这是一次会议,所以我尝试了以下方法

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

但是foundItem为null,也没有MeetingItem ...

有人有主意吗?

解决方法

好的,我找到了解决方法:

如果需要定期约会或开会,我可以通过recurrencePattern填充属性 StartTime EndTime

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

但是为什么AppointmentItem的Start和End属性不存在,我无法回答。

也许这会帮助某人

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...