展望插件:从一个选定的日历元素插件、元素、日历

2023-09-03 04:38:33 作者:我存在在你的存在里

我创建一个Outlook插件的,我想知道如何从一个选定的日历元素呢? 对于为例,我需要从一个名为myCalendar日历中的所有约会项目。 现在,我可以得到所有约会项目从所有日历。

I'm creating an Outlook add-in and i'd like to know how to get elements from a selected calendar? For exemple, i need to get all Appointments items from a calendar named "myCalendar". Now, i can just get all appointments items from ALL calendars.

感谢您,

推荐答案

这些额外的日历都可以作为主日历文件夹的子文件夹。因此,这里是你怎么做:

Those extra Calendars are available as subfolders of the main Calendar folder. So here is what you do:

获取一个参考使用主日历文件夹

Get a reference to the main calendar folder using

Outlook.MAPIFolder日历= Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);

Outlook.MAPIFolder calendar = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);

枚举 calendar.Folders 集合,直到你找到一个与 MAPIFolder.Name 您正在寻找为

Enumerate the calendar.Folders collection until you find one with the MAPIFolder.Name you are looking for.

这是MAPIFolder,枚举所有产品 Outlook.AppointmentItem 就像你已经在做。

From that MAPIFolder, enumerate all Items as Outlook.AppointmentItem like you are already doing.