c# - C# -> COM -> 更改约会 -> 填充 Start 和 End 时出现异常 -> 对象不支持此方法
问题描述
我想更改现有约会。为此,我通过以下方式搜索现有约会:
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;
}
}
}
或者:
foundItem = outlookItems.Find(filter) as Outlook.AppointmentItem;
if (foundItem != null)
{foundItem.Start = start}
无论如何,如果我想填写 appoitnment.Start 属性,它会遇到这个异常:
“该对象不支持此方法。”
我的想法是这是一个会议,所以我尝试了以下方法:
Outlook.MeetingItem foundItem = outlookItems.Find(filter) as Outlook.MeetingItem;
Outlook.AppointmentItem aptItem = foundItem.GetAssociatedAppointment(false);
但是foundItem为空,也没有MeetingItem ...
有人有想法吗?
解决方案
好的,我自己找到了一个解决方案:
在定期约会或会议的情况下,我从recurrencePattern 中填写属性StartTime和EndTime :
newRecurrencePatternForOutlook.StartTime = start;
newRecurrencePatternForOutlook.EndTime = end;
但是为什么 AppointmentItem 的 Start 和 End 属性不存在,我无法回答。
也许这会帮助某人
推荐阅读
- c# - Azure 函数 SDK 导致 Newtonsoft 问题
- javascript - 如何用jQuery替换innerHTML?
- kotlin - 如何在 Koin 中提供基类?
- postgresql - 当我不知道其名称时更改默认顺序
- git - 在子模块中使用 .gitattributes 作为合并策略
- sql-server - 循环/更新结果,直到列的总和(bigint)小于指定的数字
- javascript - 如果我在 jquery 绑定中更改,为什么 html 表的顺序不会改变?
- ios - 播放视频时如何自动跳过 youtube iOS 应用中的广告?
- if-statement - 检测到 ArrayFormula 循环依赖
- java - 如何在垂直滚动视图上使用浮动按钮?