【发布时间】:2017-07-01 01:00:00
【问题描述】:
我正在开发我的插件并面临下一个问题:看起来 MeetingItems 的工作方式与 MailItems 不同。
我需要做什么:
- 在发送之前将 MeetingItem 保存到草稿中。
- 添加附件。
- 发送。
1 将 MeetingItem 保存到草稿:
(Item as MeetingItem).GetAssociatedAppointment(false).GetInspector.Close(OlInspectorClose.olSave);
有效。
2。添加附件。
Attaches = (Item as MeetingItem).GetAssociatedAppointment(false).Attachments;
Attaches.Add(...).
它也有效。
3.发送邮件。
试一试:
(Item as MeetingItem).Send(); << it doesn't work.
Try2:
AppointmentItem appItem = Item.GetAssociatedAppointment(false);
appItem.Send(); << It works. But MeetingItem is still in drafts folder (???)
Item.Delete(); << Moved to deleted folder, and can't delete permanently.
它认为在第三步我做错了什么。你知道如何正确发送 MeetingItem 吗?
更新:
当我发送 MeetingItem 时,Outlook 会询问我“你想现在更新你自己的日历吗”。如果我按是,则根本不会调用 Application_ItemSend 回调,因此我无法添加附件。我很困惑那里发生了什么。
更新 2:
看来,当我添加附件已经收到的消息时,我应该使用
(Item as MailItem).Attachments.Add(...)
但是当我发送邮件时,我应该使用
(Item as MailItem).GetAssociatedAppointment(false).Attachments.Add(...)
令人困惑。
【问题讨论】:
标签: c# outlook vsto outlook-addin