Hy guys。
这里有任何教程如何导出范围从1 Yeahr作为vcs和ics文件的日历?
我已经尝试过:
OutlookNS = outlook.GetNamespace("MAPI");
Outlook.MAPIFolder f = OutlookNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
Outlook.CalendarSharing cs = f.GetCalendarExporter();
cs.CalendarDetail = Outlook.OlCalendarDetail.olFullDetails;
cs.StartDate = new DateTime(2015, 11, 1);
cs.EndDate = new DateTime(2016, 12, 31);
cs.SaveAsICal(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\calender.ics");
我得到的错误:
The object reference was not set to an object instance
那我该怎么办请帮助我:)。
答案 0 :(得分:0)
有效的代码:
OutlookNS = Globals.ThisAddIn.Application.GetNamespace("MAPI");
Outlook.MAPIFolder f = OutlookNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
Outlook.CalendarSharing cs = f.GetCalendarExporter();
cs.CalendarDetail = Outlook.OlCalendarDetail.olFullDetails;
cs.StartDate = new DateTime(2015, 11, 1);
cs.EndDate = new DateTime(2016, 12, 31);
cs.SaveAsICal(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\kalender.ics");