public List<CalendarEvent> GetCalendarEvents(DateTime rangeFrom, DateTime rangeTo)
        {
            var app = new Outlook.Application();

            Outlook.Folder calendarFolder = app.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.Folder;

            Outlook.Items outlookEvents = getAppointmentsInRange(calendarFolder, rangeFrom, rangeTo);

            List<CalendarEvent> calendarEvents = new List<CalendarEvent>();

            foreach (Outlook.AppointmentItem outlookEvent in outlookEvents)
            {
                var calendarEvent = new OutlookCalendarEvent()
                {
                    DateFrom = outlookEvent.Start,
                    DateTo = outlookEvent.End,
                    Description = string.Format("{0}", outlookEvent.Body),
                    Location = outlookEvent.Location,
                    Title = outlookEvent.Subject,
                    ID = outlookEvent.GlobalAppointmentID,
                    SourceID = outlookEvent.ItemProperties["SourceID"] != null ? outlookEvent.ItemProperties["SourceID"].ToString() : outlookEvent.GlobalAppointmentID
                };

                calendarEvents.Add(calendarEvent);
            }

            return calendarEvents;
        }
        public List <CalendarEvent> GetCalendarEvents(DateTime rangeFrom, DateTime rangeTo)
        {
            var app = new Outlook.Application();


            Outlook.Folder calendarFolder = app.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.Folder;

            Outlook.Items outlookEvents = getAppointmentsInRange(calendarFolder, rangeFrom, rangeTo);

            List <CalendarEvent> calendarEvents = new List <CalendarEvent>();

            foreach (Outlook.AppointmentItem outlookEvent in outlookEvents)
            {
                var calendarEvent = new OutlookCalendarEvent()
                {
                    DateFrom    = outlookEvent.Start,
                    DateTo      = outlookEvent.End,
                    Description = string.Format("{0}", outlookEvent.Body),
                    Location    = outlookEvent.Location,
                    Title       = outlookEvent.Subject,
                    ID          = outlookEvent.GlobalAppointmentID,
                    SourceID    = outlookEvent.ItemProperties["SourceID"] != null ? outlookEvent.ItemProperties["SourceID"].ToString() : outlookEvent.GlobalAppointmentID
                };

                calendarEvents.Add(calendarEvent);
            }

            return(calendarEvents);
        }