将 ics 文件导入 Outlook.AppointmentItem
我有一个 Outlook 2007 加载项,它尝试将 ics 文件导入 Outlook.AppointmentItem 对象,以便我可以读取有关某些约会的属性。目前我无法将 ics 读回内存。关于我做错了什么的任何建议。
Outlook.Application app = new Outlook.Application();
var item = app.Session.OpenSharedItem("C:\\meeting.ics") as Outlook.AppointmentItem;
string meetingBody = item.Body; //<--*my item is null*
谢谢
I have an Outlook 2007 add-in that is trying to import ics files into Outlook.AppointmentItem objects so that I can read attributes about certain appointments. Currently I am not able to read the ics back into memory. Any suggestions on what I am doing wrong.
Outlook.Application app = new Outlook.Application();
var item = app.Session.OpenSharedItem("C:\\meeting.ics") as Outlook.AppointmentItem;
string meetingBody = item.Body; //<--*my item is null*
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为问题是由于 AppointmentItem 和 MeetingItem 是不同的类,因此您无法直接将一个类转换为另一个类。您可以尝试以下操作并检查它是否有效吗?
I think the problem is due to the fact that AppointmentItem and MeetingItem are different classes so you cannot convert one to another directly. Could you try the following and check if it works?
这可能是因为该 ics 文件仅呈现会议项目而不是约会项目。据我所知,您可以尝试使用如下代码,
如果您对此有任何疑问,请随时跟进。
http://social.msdn .microsoft.com/Forums/en-GB/vsto/thread/f98bfa75-a995-403e-a3fc-5be3a37511d7
It may be because that this ics file just presents a meeting item rather an appointment item. As far as I know, you could try to use code as below,
If you have any concern for this, please feel free to follow up.
http://social.msdn.microsoft.com/Forums/en-GB/vsto/thread/f98bfa75-a995-403e-a3fc-5be3a37511d7
只需检查其类型
Just check its type