Outlook VSTO How to export the Calender as ics AND vcs? RRS feed

  • Question

  • Hy guys.

    Any tutorials here how to export a Calender with a range from 1 Yeahr as a vcs and ics file to the desktop?

    Thanks for help!

    Friday, December 2, 2016 10:16 AM


  • Did it by myselfe:

    here is the code that works to export the calendar:

                //Hole den Namespace der Kalender
                OutlookNS = Globals.ThisAddIn.Application.GetNamespace("MAPI");
                //Suche den Folder wo die Kalender gespeichert sind
                Outlook.MAPIFolder f = OutlookNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
                //Speicher den Kalender mit den Daten innerhalb eines Jahres ab
                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");

    • Marked as answer by lukasrein97 Friday, December 2, 2016 11:37 AM
    Friday, December 2, 2016 11:37 AM