コード例 #1
0
        public static CalendarEntry FromOutlook(AppointmentItem i)
        {
            var e = new CalendarEntry();

            e.Start       = i.Start;
            e.Duration    = TimeSpan.FromMinutes(i.Duration);
            e.Title       = i.Subject;
            e.Location    = i.Location;
            e.Description = i.Body;
            e.UniqueID    = i.EntryID;

            return(e);
        }
コード例 #2
0
        public void Refresh()
        {
            Entries.Clear();

            var outlook       = new Microsoft.Office.Interop.Outlook.Application();
            var mapiNamespace = outlook.GetNamespace("MAPI");;
            var folder        = mapiNamespace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);
            var items         = folder.Items;

            items.Sort("[Start]");
            items.IncludeRecurrences = true;

            var startDate = DateTime.Today.AddMonths(-1);
            var endDate   = DateTime.Today.AddMonths(1);

            var currentEvent = items.Find(String.Format("[Start] >= \"{0:D}\" and [Start] <= \"{1:D}\"", startDate, endDate));

            while (currentEvent != null)
            {
                Entries.Add(CalendarEntry.FromOutlook((AppointmentItem)currentEvent));
                currentEvent = items.FindNext();
            }
        }
コード例 #3
0
        public void AddEntry(CalendarEntry newEntry)
        {
            if (!Authenticated)
            {
                throw new GoogleCalendarException("Not Authenticated");
            }

            Event e = new Event();

            e.Start = new EventDateTime()
            {
                DateTime = newEntry.Start.ToUniversalTime().ToString("O"), TimeZone = "UTC"
            };
            e.End = new EventDateTime()
            {
                DateTime = newEntry.End.ToUniversalTime().ToString("O"), TimeZone = "UTC"
            };
            e.Summary     = newEntry.Title;
            e.Description = newEntry.Description + String.Format("\r\nOutlook ID:{0}", newEntry.UniqueID);
            e.Location    = newEntry.Location;

            service.Events.Insert(e, ActiveCalendar).Execute();
        }
コード例 #4
0
 public void AddEntry(CalendarEntry newEntry)
 {
     throw new NotImplementedException();
 }
コード例 #5
0
 public bool EntryExists(CalendarEntry entry)
 {
     throw new NotImplementedException();
 }