.NET: Get all Outlook calendar items

前端 未结 11 1343
情书的邮戳
情书的邮戳 2020-12-02 09:41

How can I get all items from a specific calendar (for a specific date). Lets say for instance that I have a calendar with a recurring item every Monday evening. When I requ

11条回答
  •  爱一瞬间的悲伤
    2020-12-02 10:07

    I wrote similar code, but then found the export functionality:

    Application outlook;
    NameSpace OutlookNS;
    
    outlook = new ApplicationClass();
    OutlookNS = outlook.GetNamespace("MAPI");
    
    MAPIFolder f = OutlookNS.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
    
    CalendarSharing cs = f.GetCalendarExporter();
    cs.CalendarDetail = OlCalendarDetail.olFullDetails;
    cs.StartDate = new DateTime(2011, 11, 1);
    cs.EndDate = new DateTime(2011, 12, 31);
    cs.SaveAsICal("c:\\temp\\cal.ics");
    

提交回复
热议问题