public static void CreateGoogleCalendarEvent(string title, DateTime startTime, DateTime endTime, string calendar) { AuthorizeGoogleCalendar(); CalendarListResource.ListRequest calRequest = calendarService.CalendarList.List(); calRequest.MinAccessRole = CalendarListResource.ListRequest.MinAccessRoleEnum.Owner; CalendarList calendars = calRequest.Execute(); CalendarListEntry reminderCalendar = calendars.Items.Where(p => p.Summary == calendar).FirstOrDefault(); Event newReminderEvent = new Event() { Summary = title }; newReminderEvent.Start = new EventDateTime() { DateTime = startTime }; newReminderEvent.End = new EventDateTime() { DateTime = endTime }; EventsResource.InsertRequest createRequest = calendarService.Events.Insert(newReminderEvent, reminderCalendar.Id); createRequest.Execute(); }
public Scheduler(CalendarListEntry calendar, params Event[] events) { Calendar = calendar; Color = ColorTranslator.FromHtml(calendar.BackgroundColor); Events = new List <Event>(events); Selected = true; }
//not yet tested!! public static Calendar updateCalendarByName(string oldName, string newName, string newLocation = "unknown", string newDescription = "none", string newTimeZone = "America/Los_Angeles") { var calenders = getCalenders(); CalendarListEntry foundCalendar = null; foreach (CalendarListEntry cal in calenders) { if (cal.Summary == oldName) { foundCalendar = cal; } } // Make a change //because foundCalendar is a CalendarListEntry we have to convert it to a Calendar Calendar calendar = null; calendar.Summary = newName; calendar.Location = newLocation; calendar.Description = newDescription; calendar.TimeZone = newTimeZone; calendar.Id = foundCalendar.Id; // Update the altered calendar return(service.Calendars.Update(calendar, foundCalendar.Id).Execute()); }
/// <summary> /// Adds an entry to the user's calendar list. /// Documentation https://developers.google.com/calendar/v3/reference/calendarList/insert /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Calendar service.</param> /// <param name="body">A valid Calendar v3 body.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>CalendarListEntryResponse</returns> public static CalendarListEntry Insert(CalendarService service, CalendarListEntry body, CalendarListInsertOptionalParms optional = null) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } // Building the initial request. var request = service.CalendarList.Insert(body); // Applying optional parameters to the request. request = (CalendarListResource.InsertRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request CalendarList.Insert failed.", ex); } }
async Task UpdateCalendarListUI() { CalendarListResource.ListRequest listRequest = this.service.CalendarList.List(); this.calendarList = await listRequest.ExecuteAsync(); this.ricbCalendarList.Items.Clear(); foreach (CalendarListEntry item in this.calendarList.Items) { this.ricbCalendarList.Items.Add(item.Summary); } if (!String.IsNullOrEmpty(this.activeCalendarId)) { CalendarListEntry itemToSelect = this.calendarList.Items.FirstOrDefault(x => x.Id == this.activeCalendarId); this.dxGoogleCalendarSync.CalendarId = this.activeCalendarId; if (this.ricbCalendarList.Items.Contains(itemToSelect.Summary)) { this.beiCalendarList.EditValue = itemToSelect.Summary; } else { this.activeCalendarId = String.Empty; } } UpdateBbiAvailability(); }
static void GetEvents(CalendarListEntry calendar, CalendarService service) { EventsResource.ListRequest request = service.Events.List(calendar.Id); request.TimeMin = DateTime.Now; request.TimeMax = DateTime.Now.AddDays(7); request.ShowDeleted = false; request.SingleEvents = true; request.MaxResults = 10; request.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime; Events events = request.Execute(); if (events.Items != null && events.Items.Count > 0) { foreach (var eventItem in events.Items) { string when = eventItem.Start.DateTime.ToString(); if (String.IsNullOrEmpty(when)) { when = eventItem.Start.Date; } Console.WriteLine("{0} ({1})", eventItem.Summary, when); } } else { Console.WriteLine("No upcoming events found."); } }
void UpdateFromGoogleCalendar() { LockStorageEvents = true; CalendarListEntry calendarEntry = this.cbCalendars.SelectedValue as CalendarListEntry; Calendar calendar = CalendarService.Calendars.Get(calendarEntry.Id).Execute(); EventsResource.ListRequest listRequest = CalendarService.Events.List(calendarEntry.Id); listRequest.MaxResults = 10000; Events events = listRequest.Execute(); Log("Loaded {0} events", events.Items.Count); this.schedulerStorage1.Appointments.Items.Clear(); this.schedulerStorage1.BeginUpdate(); try { CalendarImporter importer = new CalendarImporter(this.schedulerStorage1); importer.Import(events.Items); } finally { this.schedulerStorage1.EndUpdate(); } SetStatus(String.Format("Loaded {0} events", events.Items.Count)); UpdateFormState(); LockStorageEvents = false; }
public GoogleCalendarListEntry(CalendarListEntry init) { AccessRole = init.AccessRole; Id = init.Id; Name = init.SummaryOverride ?? init.Summary; primary = init.Primary ?? false; }
/// <summary> /// Retrieve calendar's Event colours from Google /// </summary> public void Get() { log.Debug("Retrieving calendar Event colours."); Colors colours = null; CalendarListEntry calendarColour = null; colourPalette = new List <Palette>(); try { colours = GoogleOgcs.Calendar.Instance.Service.Colors.Get().Execute(); calendarColour = GoogleOgcs.Calendar.Instance.Service.CalendarList.Get(Settings.Instance.UseGoogleCalendar.Id).Execute(); } catch (System.Exception ex) { log.Error("Failed retrieving calendar Event colours."); OGCSexception.Analyse(ex); return; } if (colours == null) { log.Warn("No colours found!"); } else { log.Debug(colours.Event__.Count() + " colours found."); } foreach (KeyValuePair <String, ColorDefinition> colour in colours.Event__) { colourPalette.Add(new Palette(colour.Key, colour.Value.Background, OutlookOgcs.CategoryMap.RgbColour(colour.Value.Background))); } if (calendarColour != null && calendarColour.BackgroundColor != null) { colourPalette.Add(new Palette("Custom", calendarColour.BackgroundColor, OutlookOgcs.CategoryMap.RgbColour(calendarColour.BackgroundColor))); } }
private void RegisterCalendar() { CalendarListEntry cle = new CalendarListEntry(); // This is the ID of a new calendar that we want to show on the site cle.Id = "*****@*****.**";//"*****@*****.**"; CalendarListEntry cleNew = GetCalendarService().CalendarList.Insert(cle).Execute(); }
public static string GetCalendarIdForName(this CalendarService service, string name) { CalendarListResource.ListRequest listRequest = service.CalendarList.List(); CalendarList calendarList = listRequest.Execute(); CalendarListEntry entry = calendarList.Items?.FirstOrDefault(e => e.Summary == name); return(entry?.Id); }
void OnCbCalendarsSelectedValueChanged(object sender, EventArgs e) { CalendarEntry = this.cbCalendars.SelectedValue as CalendarListEntry; this.dxGoogleCalendarSync1.Storage = null; this.schedulerStorage1.Appointments.Clear(); this.dxGoogleCalendarSync1.Storage = this.schedulerStorage1; Synchronize(); UpdateFormState(); }
private static CalendarListEntry GetCalendarListEntry(CalendarService service) { CalendarListResource.ListRequest calendarListRequest = service.CalendarList.List(); CalendarList calendarList = calendarListRequest.Execute(); CalendarListEntry dienstplan = calendarList.Items.FirstOrDefault(x => x.Summary == _calendarName); return(dienstplan); }
public GoogleCalendarListEntry(CalendarListEntry init) { AccessRole = init.AccessRole; Id = init.Id; Name = init.SummaryOverride ?? init.Summary; primary = init.Primary ?? false; Hidden = init.Hidden ?? false; ColourId = init.ColorId; }
private void toolStripButtonGo_Click(object sender, EventArgs e) { if (this.listViewCalendars.SelectedItems.Count > 1) { this.toolStripStatusLabelGoogle1.Text = "Error: Select only one Calendar."; return; } else if (this.listViewCalendars.SelectedItems.Count == 0) { this.toolStripStatusLabelGoogle1.Text = "Error: Select only one Calendar."; return; } //get the CalendarEntry from the selected calendar list CalendarListEntry calendarEntry = (CalendarListEntry)this.listViewCalendars.SelectedItems[0].Tag; //clear results from prior runs this.listBoxResults.Items.Clear(); this.listBoxResults.SelectedIndex = this.listBoxResults.Items.Add("Beginning process of importing Microsoft® Project tasks into events."); int addedEvents = 0; //count foreach (ListViewItem taskItem in this.listViewTasks.CheckedItems) { //grab the Microsoft® Project Task from the list item Task task = (Task)taskItem.Tag; //convert to EventEntry Event eventEntry = translateProjectTaskToCalendarEntry(task); //set the title and content of the entry. eventEntry.Summary = taskItem.Text; eventEntry.Description = taskItem.Text; this.toolStripStatusLabelGoogle1.Text = "Status: Adding event " + eventEntry.Summary + ". Please wait..."; Application.DoEvents(); //do some work here try { //insert event into Calendar System.Diagnostics.Debug.WriteLine("[*] Adding " + eventEntry.Summary + " to " + calendarEntry.Summary + "."); //AtomEntry insertedEntry = calendarService.Insert(new Uri(calendarEntry.Links[0].AbsoluteUri), eventEntry); Event insertedEntry = calendarService.Events.Insert(eventEntry, calendarEntry.Id).Execute(); this.listBoxResults.SelectedIndex = this.listBoxResults.Items.Add("Added " + eventEntry.Summary + " to " + calendarEntry.Summary + ". Updated at: " + insertedEntry.Updated.ToString()); addedEvents++; } catch (Exception ex) { this.listBoxResults.SelectedIndex = this.listBoxResults.Items.Add("Error adding " + eventEntry.Summary + ". Details: " + ex.Message); } } this.toolStripStatusLabelGoogle1.Text = "Success: Added all " + addedEvents + " tasks as events to your " + calendarEntry.Summary + " Google® Calendar."; this.listBoxResults.SelectedIndex = this.listBoxResults.Items.Add("Import is complete! Thank you for using this tool."); this.listBoxResults.SelectedIndex = this.listBoxResults.Items.Add("Visit http://www.daball.me/ for more about the author."); this.buttonClose.Show(); Application.DoEvents(); }
private void RicbCalendarList_SelectedIndexChanged(object sender, EventArgs e) { ComboBoxEdit edit = (ComboBoxEdit)sender; string selectedCalendarSummary = (string)edit.SelectedItem; CalendarListEntry selectedCalendar = this.calendarList.Items.FirstOrDefault(x => x.Summary == selectedCalendarSummary); this.activeCalendarId = selectedCalendar.Id; this.dxGoogleCalendarSync.CalendarId = selectedCalendar.Id; UpdateBbiAvailability(); }
public static CalendarListResource.PatchRequest SetColor(this CalendarListResource calendarList, string calendarId, string color) { var calListEntry = new CalendarListEntry { BackgroundColor = color }; var setColourRequest = calendarList.Patch(calListEntry, calendarId); setColourRequest.ColorRgbFormat = true; return(setColourRequest); }
void OnAppointmentsChanged(object sender, PersistentObjectsEventArgs e) { if (LockStorageEvents || !isConnected) { return; } CalendarListEntry calendarEntry = this.cbCalendars.SelectedValue as CalendarListEntry; CalendarExporter exporter = new CalendarExporter(CalendarService, calendarEntry); exporter.Export(e.Objects as IList <Appointment>); }
/// <summary> /// Метод для подробного просмотра события /// </summary> /// <param name="selEvent">Выбранное событие</param> /// <param name="selCalendar">Выбранный календарь</param> private void MoreDetails(Event selEvent, CalendarListEntry selCalendar) { if (Application.OpenForms.Cast <Form>().Any(f => f.Name == "InfoEvent")) { Application.OpenForms["InfoEvent"].Close(); } InfoEvent info = new InfoEvent(work, selEvent, selCalendar); info.Show(); }
/// <summary> /// Adds an entry to the user's calendar list. /// Documentation:https://developers.google.com/google-apps/calendar/v3/reference/calendarList/insert /// </summary> /// <param name="service">Valid Autenticated Calendar service</param> /// <param name="id">Calendar identifier.</param> /// <returns>CalendarList resorce: https://developers.google.com/google-apps/calendar/v3/reference/calendarList#resource </returns> public static CalendarListEntry insert(CalendarService service, CalendarListEntry body) { try { return(service.CalendarList.Insert(body).Execute()); } catch (Exception ex) { Console.WriteLine(ex.Message); return(null); } }
/// <summary> /// Updates an entry on the user's calendar list. /// Documentation:https://developers.google.com/google-apps/calendar/v3/reference/calendarList/update /// </summary> /// <param name="service">Valid Autenticated Calendar service</param> /// <param name="id">Calendar identifier.</param> /// <param name="body">Changes you want to make: Use var body = DaimtoCalendarListHelper.get(service,id); /// to get body then change that and pass it to the method.</param> /// <returns>CalendarList resorce: https://developers.google.com/google-apps/calendar/v3/reference/calendarList#resource </returns> public static CalendarListEntry update(CalendarService service, string id, CalendarListEntry body) { try { return(service.CalendarList.Update(body, id).Execute()); } catch (Exception ex) { Console.WriteLine(ex.Message); return(null); } }
public void DownloadUpdates(int days) { if (Enabled && !String.IsNullOrEmpty(this.ID)) { //Update Calendar details try { CalendarListEntry calendarEntry = _Service.CalendarList.Get(this.ID).Execute(); this.DefaultReminders = calendarEntry.DefaultReminders; } catch (Exception e) { Logging.LogException(false, e); //Do nothing. Use the defaults we already have } _fetchedEvents.Clear(); EventsResource.ListRequest Fetcher = _Service.Events.List(this.ID); Fetcher.SingleEvents = true; Fetcher.TimeMin = DateTime.Today; Fetcher.TimeMax = DateTime.Today.AddDays(days); // Download Events (First Try) try { FetchEvents(Fetcher); DownloadError = false; return; } catch (Exception e) { Logging.LogException(false, e, String.Format("Error downloading events in Calendar.DownloadGvents({0})", days), String.Format("Calendar: {0}", Name), ID, "The program will try once more"); } // Download Events (Second Try) try { FetchEvents(Fetcher); DownloadError = false; return; } catch (Exception e) { Logging.LogException(false, e, "Skipping this calendar"); DownloadError = true; } } }
public static string deleteCalendarByName(string name) { var calenders = getCalenders(); CalendarListEntry foundCalander = null; foreach (CalendarListEntry cal in calenders) { if (cal.Summary == name) { foundCalander = cal; } } return(service.Calendars.Delete(foundCalander.Id).Execute()); }
private GCal Convert(CalendarListEntry c) { if (c == null) { return(null); } GCal gcal = new GCal(); gcal.Id = c.Id; gcal.Title = c.Summary; gcal.Link = ""; gcal.ColorId = c.ColorId; return(gcal); }
private Calendar(CalendarListEntry entry) { if (entry == null) { throw new ArgumentNullException("entry"); } Name = entry.Summary; ID = entry.Id; Enabled = entry.Selected ?? false; this.DefaultReminders = entry.DefaultReminders; if (this.DefaultReminders == null) { this.DefaultReminders = new List <EventReminder>(); } SetColor(entry.ColorId); }
public async Task <ResponseDto <BaseModelDto> > InsertCalendar(AddCalendarBindingModel model, string username) { var response = new ResponseDto <BaseModelDto>(); var service = await _googleCalendarService.GetCalendarService(); if (service == null) { response.Errors.Add(ServiceErrors.SERVICE_ERROR); return(response); } var calendar = new Calendar { Summary = model.Summary, Description = model.Description, TimeZone = timezone }; var createdCalendar = await service.Calendars.Insert(calendar).ExecuteAsync(); var calendarId = createdCalendar.Id; CalendarListEntry calendarListEntry = new CalendarListEntry { Id = calendarId, }; var insertRequest = service.CalendarList.Insert(calendarListEntry); insertRequest.ColorRgbFormat = true; insertRequest.Execute(); var user = await _userManager.FindByNameAsync(username); var dbCalendar = new GCalendar { Id = calendarListEntry.Id, Description = model.Description, Summary = model.Summary, Events = new List <GEvent>(), User = user }; await _calendarRepository.Insert(dbCalendar); return(response); }
void OnCbCalendarsSelectedValueChanged(object sender, EventArgs e) { CalendarListEntry calendarEntry = this.cbCalendars.SelectedValue as CalendarListEntry; Calendar calendar = CalendarService.Calendars.Get(calendarEntry.Id).Execute(); Events events = CalendarService.Events.List(calendarEntry.Id).Execute(); Log("Loaded {0} events", events.Items.Count); this.schedulerStorage1.Appointments.Items.Clear(); this.schedulerStorage1.BeginUpdate(); try { CalendarImporter importer = new CalendarImporter(this.schedulerStorage1); importer.Import(events.Items); } finally { this.schedulerStorage1.EndUpdate(); } SetStatus(String.Format("Loaded {0} events", events.Items.Count)); UpdateFormState(); }
private string createCalendar(CalendarService calendarService) { var calender = new Calendar(); calender.Summary = _calendarName; var insertNewCalenderRequest = calendarService.Calendars.Insert(calender); var cal = insertNewCalenderRequest.Execute(); CalendarListEntry cle = new CalendarListEntry(); cle.Id = cal.Id; CalendarListResource.InsertRequest insertCalendarRequest = calendarService.CalendarList.Insert(cle); var item = insertCalendarRequest.Execute(); return(cal.Id); }
public LocalCalendar(CalendarListEntry googleCalendar) : base() { this.Description = googleCalendar.Description; this.Id = googleCalendar.Id; this.Summary = googleCalendar.Summary; this.TimeZone = googleCalendar.TimeZone; this.AccessRole = googleCalendar.AccessRole; this.BackgroundColor = googleCalendar.BackgroundColor; this.ColorId = googleCalendar.ColorId; this.DefaultReminders = googleCalendar.DefaultReminders; this.ETag = googleCalendar.ETag; this.ForegroundColor = googleCalendar.ForegroundColor; this.Hidden = googleCalendar.Hidden; this.Kind = googleCalendar.Kind; this.Location = googleCalendar.Location; this.Primary = googleCalendar.Primary; this.Selected = googleCalendar.Selected; this.SummaryOverride = googleCalendar.SummaryOverride; }
void OnBtnConnectClick(object sender, EventArgs e) { cbCalendars.SelectedValueChanged -= OnCbCalendarsSelectedValueChanged; UserCredential credential; using (var stream = new FileStream("secret\\client_secret.json", FileMode.Open, FileAccess.Read)) { string credPath = System.Environment.GetFolderPath( System.Environment.SpecialFolder.Personal); credPath = Path.Combine(credPath, ".credentialss"); credential = GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets, Scopes, "user", CancellationToken.None, new FileDataStore(credPath, true)).Result; Log("Credential file saved to: " + credPath); } // Create Google Calendar API service. CalendarService = new CalendarService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = ApplicationName, }); var calendarListRequtes = CalendarService.CalendarList.List(); CalendarList calendarList = calendarListRequtes.Execute(); foreach (var item in calendarList.Items) { Log(item.Summary); } cbCalendars.DisplayMember = "Summary"; cbCalendars.DataSource = calendarList.Items; cbCalendars.SelectedValueChanged += OnCbCalendarsSelectedValueChanged; CalendarEntry = this.cbCalendars.SelectedValue as CalendarListEntry; Synchronize(); UpdateFormState(); }
protected void Page_Load(object sender, EventArgs e) { AccountName = Session["GapiUserId"] as string; Integrator = Session["GooCalIntegrator"] as GooCalIntegrator; var selectedCalendarId = Session["SelectedCalendarId"] as string; // проверка if (Integrator == null || string.IsNullOrEmpty(AccountName) || string.IsNullOrEmpty(selectedCalendarId)) { Response.Redirect("Page2.aspx", true); return; } // пробую получить календарь var result = Integrator.GetCalendar(selectedCalendarId); if (result is Exception) { RenderException(result as Exception); } CalendarEntry = result as CalendarListEntry; result = Integrator.GetEvents(selectedCalendarId); if (result is Exception) { RenderException(result as Exception); } CalendarEvents = result as List <Event>; AccountNameLabel.InnerText = "Account Name: " + AccountName; CalendarDescriptionLabel.InnerText = string.Format("Selecated calendar: {0} ({1} events)", CalendarEntry.Summary, CalendarEvents.Count); EventsTableIndex = 0; EventsTableRepeater.DataSource = CalendarEvents; }
/* * Load All CalendarList * * @param: CalendarListLoaded : a callback */ public void LoadCalendarList(Action<IRestResponse<CalendarList>> CalendarListLoaded) { _oAuth.GetAccessCode(access_token => { lock (_sync) { _requesting++; // building request _client.Authenticator = new OAuth2AuthorizationRequestHeaderAuthenticator(access_token); var request = new RestRequest("/calendar/v3/users/me/calendarList", Method.GET); _client.ExecuteAsync<CalendarList>(request, response => { lock (_sync) { _requesting--; // handle callback _calendarLoaded = true; _calendar = response.Data != null ? response.Data.Items[3] : _calendar; if (CalendarListLoaded != null) CalendarListLoaded(response); } }); } }); }
void Subscribe(CalendarListEntry cal, int orgId) { SetCalendar(orgId, true); Dictionary<string, string> param = new Dictionary<String, String>(); Channel request = new Channel(); request.Id = System.Guid.NewGuid().ToString(); request.Type = "web_hook"; request.Params = param; if (cal.Id == "*****@*****.**") { request.Address = "https://dev.zerofootprint.com.au/notification/Default.aspx"; } else { request.Address = "https://dev.zerofootprint.com.au/notification/ChildCalendar.aspx"; } try { var changes = service.Events.Watch(request, cal.Id).Execute();//.CalendarList.Events.cal(request, "*****@*****.**").Execute(); } catch { } }
/// <summary>Displays the calendar's events.</summary> private static void DisplayFirstCalendarEvents(CalendarListEntry list) { Console.WriteLine(Environment.NewLine + "Maximum 5 first events from {0}:", list.Summary); Google.Apis.Calendar.v3.EventsResource.ListRequest requeust = service.Events.List(list.Id); // Set MaxResults and TimeMin with sample values requeust.MaxResults = 5; requeust.TimeMin = new DateTime(2013, 10, 1, 20, 0, 0); // Fetch the list of events foreach (Google.Apis.Calendar.v3.Data.Event calendarEvent in requeust.Execute().Items) { string startDate = "Unspecified"; if (((calendarEvent.Start != null))) { if (((calendarEvent.Start.Date != null))) { startDate = calendarEvent.Start.Date.ToString(); } } Console.WriteLine(calendarEvent.Summary + ". Start at: " + startDate); } }
/// <summary> /// Updates an entry on the user's calendar list. /// Documentation:https://developers.google.com/google-apps/calendar/v3/reference/calendarList/update /// </summary> /// <param name="service">Valid Autenticated Calendar service</param> /// <param name="id">Calendar identifier.</param> /// <param name="body">Changes you want to make: Use var body = DaimtoCalendarListHelper.get(service,id); /// to get body then change that and pass it to the method.</param> /// <returns>CalendarList resorce: https://developers.google.com/google-apps/calendar/v3/reference/calendarList#resource </returns> public static CalendarListEntry update(CalendarService service, string id, CalendarListEntry body) { try { return service.CalendarList.Update(body, id).Execute(); } catch (Exception ex) { Console.WriteLine(ex.Message); return null; } }
/// <summary> /// Adds an entry to the user's calendar list. /// Documentation:https://developers.google.com/google-apps/calendar/v3/reference/calendarList/insert /// </summary> /// <param name="service">Valid Autenticated Calendar service</param> /// <param name="id">Calendar identifier.</param> /// <returns>CalendarList resorce: https://developers.google.com/google-apps/calendar/v3/reference/calendarList#resource </returns> public static CalendarListEntry insert(CalendarService service, CalendarListEntry body) { try { return service.CalendarList.Insert(body).Execute(); } catch (Exception ex) { Console.WriteLine(ex.Message); return null; } }
private void UpdateEvents(LocalCalendar calendarToUpdate) { CalendarListEntry calendarSelected = new CalendarListEntry(); if (calendarToUpdate != null && calendarToUpdate is CalendarListEntry) { currentEventList.Clear(); // remove any existing events EventsResource.ListRequest listRequest = service.Events.List(calendarToUpdate.Id); listRequest.TimeMin = new DateTime(StartDate.Year, StartDate.Month, StartDate.Day, StartDate.Hour, StartDate.Minute, StartDate.Second); DateTime StopDate = StartDate.AddMonths(4); listRequest.TimeMax = new DateTime(StopDate.Year, StopDate.Month, StopDate.Day, StopDate.Hour, StopDate.Minute, StopDate.Second); listRequest.SingleEvents = true; listRequest.MaxResults = 500; IList<Event> calEvents = listRequest.Execute().Items; foreach (Event calEvent in calEvents) { LocalCalendarEvent newEvent = new LocalCalendarEvent(); newEvent.AddGoogleEvent(calEvent); currentEventList.Add(newEvent); // add to collection } } }
void Subscribe(CalendarListEntry cal) { SetupCalendarForSubsription(); Dictionary<string, string> param = new Dictionary<String, String>(); Channel request = new Channel(); request.Id = System.Guid.NewGuid().ToString(); request.Type = "web_hook"; request.Params = param; if (cal.Id == "*****@*****.**") { // request.Address = "https://dev.zerofootprint.com.au/notification/Default.aspx"; request.Address = Tools.GetConfigValue("GooglePushNotificationUrl_ParentCal"); } else { // request.Address = "https://dev.zerofootprint.com.au/notification/ChildCalendar.aspx"; request.Address = Tools.GetConfigValue("GooglePushNotificationUrl_ChildCal"); } try { var changes = service.Events.Watch(request, cal.Id).Execute();//.CalendarList.Events.cal(request, "*****@*****.**").Execute(); } catch { } }
public MyCalendarListEntry(CalendarListEntry init) { Id = init.Id; Name = init.Summary; }