开发者

Dealing with multiple calendars in outlook

I want to extract all items in all my calendars in outlook. I've got it working with my default calendar, but for some unknown reason I can't get other calendars items. Here is what I have done so far:

                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;

It's from .NET: Get all Outlook calendar items . In This case CalendarFolder.Folders is empty, any help? I need a function that iterates thru all calendars, for å user (not knowing the names of the calendars).

Thanks


Try this:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜