public GDataTypes.GDataCalendarEntrys CreateCalendarEntrys(CalendarFeed calendarEntrys) { var _gDataCalendarEntrys = new GDataTypes.GDataCalendarEntrys(); foreach (CalendarEntry _calendarEntry in calendarEntrys.Entries) { var _gDataCalendarEntry = new GDataTypes.GDataCalendarEntry(); if (_calendarEntry.Title.Text != null) { _gDataCalendarEntry.Name = _calendarEntry.Title.Text; } if (_calendarEntry.Color != null) { _gDataCalendarEntry.Color = _calendarEntry.Color; } if (_calendarEntry.Summary != null) { _gDataCalendarEntry.Description = _calendarEntry.Summary.Text; } if (_calendarEntry.Location != null) { _gDataCalendarEntry.Location = _calendarEntry.Location.ValueString; } _gDataCalendarEntry.Hidden = _calendarEntry.Hidden; _gDataCalendarEntry.Selected = _calendarEntry.Selected; if (_calendarEntry.TimeZone != null) { _gDataCalendarEntry.TimeZone = _calendarEntry.TimeZone; } if (_calendarEntry.AccessLevel != null) { _gDataCalendarEntry.AccessLevel = _calendarEntry.AccessLevel; } if (_calendarEntry.SelfUri.ToString() != null) { _gDataCalendarEntry.SelfUri = _calendarEntry.SelfUri.ToString(); } _gDataCalendarEntrys.Add(_gDataCalendarEntry); } return _gDataCalendarEntrys; }
protected override void ProcessRecord() { var _domain = dgcGoogleCalendarService.GetDomain(service.CalendarService); var _calendarQuery = new CalendarQuery(); _calendarQuery.Uri = new Uri("https://www.google.com/calendar/feeds/" + id + "@" + _domain + "/allcalendars/full"); try { var _calendarFeed = service.CalendarService.Query(_calendarQuery); if (_calendarName == null) { var _calendarEntrys = dgcGoogleCalendarService.CreateCalendarEntrys(_calendarFeed); WriteObject(_calendarEntrys, true); } else { var _calendarSelection = from _selection in _calendarFeed.Entries where _selection.Title.Text.ToString() == _calendarName select _selection; var _calendarEntrys = new GDataTypes.GDataCalendarEntrys(); foreach (CalendarEntry _entry in _calendarSelection) { _calendarEntrys = dgcGoogleCalendarService.AppendCalendarEntrys(_entry, _calendarEntrys); } WriteObject(_calendarEntrys, true); } } catch (Exception _exception) { WriteObject(_exception); } }