开发者

Outlook Interop: how to iterate all the calendars?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜