0
好吧,我尝试使用下面的代码连接到从C#的Outlook日历:连接到
using Outlook = Microsoft.Office.Interop.Outlook;
Outlook.Application msOutlook = new Outlook.Application();
Outlook.NameSpace ns = msOutlook.GetNamespace("MAPI");
Outlook.MAPIFolder folder = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
foreach (Outlook.MAPIFolder subfolder in folder.Folders)
{
MessageBox.Show(subfolder.Name);
}
然而,尽管有两个日历,一段代码上面没有看到任何!
我想我可能有更多的运气与下面的代码:
Outlook.MAPIFolder folder = ns.GetFolderFromID("CalendarName", Type.Missing);
但这是抛出了以下异常:
无法打开该项目。再试一次。
我猜日历ID是不同于它的名字。
我在做什么错?
而且,我使用C#4在.NET 4和Outlook 2010
发现它,非常感谢! – JMK 2012-02-09 19:29:38