在outlook中处理多个日历

本文关键字:日历 处理 outlook | 更新日期: 2023-09-27 18:07:58

我想在outlook中提取所有日历中的所有项目。我已经让它与我的默认日历一起工作,但由于某种未知的原因,我无法获得其他日历项。以下是我到目前为止所做的:

                Microsoft.Office.Interop.Outlook.Application oApp = null;
                Microsoft.Office.Interop.Outlook.NameSpace mapiNamespace = null;
                Microsoft.Office.Interop.Outlook.MAPIFolder CalendarFolder = null;
                Microsoft.Office.Interop.Outlook.Items outlookCalendarItems = null;
                oApp = new Microsoft.Office.Interop.Outlook.Application();
                mapiNamespace = oApp.GetNamespace("MAPI"); ;
                CalendarFolder = mapiNamespace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar); outlookCalendarItems = CalendarFolder.Items;
                outlookCalendarItems.IncludeRecurrences = true;

它来自。net:获取所有Outlook日历项。在本例中是CalendarFolder。文件夹是空的,有帮助吗?我需要一个遍历所有日历的函数,对于用户(不知道日历的名称)。

谢谢

在outlook中处理多个日历

试试这个:

Application outlook = new Application();
MAPIFolder calendars = (MAPIFolder)outlook.ActiveExplorer().Session.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
            for (int i = 1; i <= calendars.Folders.Count; i++)