开发者

Outlook Interop: how to iterate all the calendars?

开发者 https://www.devze.com 2023-01-26 06:34 出处:网络
I want to get all events from all calendars, how do i iterate thru all calendar folders and the开发者_高级运维n all events for each calendar?If I had to guess, though I\'m just getting in to Outlook m

I want to get all events from all calendars, how do i iterate thru all calendar folders and the开发者_高级运维n all events for each calendar?


If I had to guess, though I'm just getting in to Outlook myself, I would suggest the following:

Outlook.Application app = new Outlook.Application();
Outlook.NameSpace ns = app.GetNamespace("MAPI");
Outlook.MAPIFolder folder = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);

Then something along the lines of

foreach (outlook.MAPIFolder subFolder in folder.Folders)
{
    // do something with subFolder
}

And you could probably create something recursive to exhaust all possibilities of the MAPIFolder.Folders property.

EDIT Ultimately, try stepping through in the debugger one you've gotten the default folder and see what you're left with. My guess is this will have the information you need.

0

精彩评论

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