1

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

Community
  • 1
  • 1
Jason94
  • 13,320
  • 37
  • 106
  • 184

1 Answers1

0

Try this:

Application outlook = new Application();
MAPIFolder calendars = (MAPIFolder)outlook.ActiveExplorer().Session.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
            for (int i = 1; i <= calendars.Folders.Count; i++)
Bill Nielsen
  • 866
  • 2
  • 7
  • 18