C# Outlook VSTO 如何将日历导出为 ics 或 vcs 文件?
C# Outlook VSTO How to export the calendar to ics or vcs file?
大家好。
这里有没有关于如何将 1 Year 范围内的 Calender 导出为 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
那我该怎么办请帮帮我:)
有效代码:
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");
大家好。
这里有没有关于如何将 1 Year 范围内的 Calender 导出为 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
那我该怎么办请帮帮我:)
有效代码:
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");