Reputation: 1323
I am trying to insert an event into a google calendar via the java API: CalendarTest
I would like to run:
new Calendar.Events.Insert(calendarId, content).execute();
except that the constructor is protected and I cannot find a static public method to do the insert. Any suggestions?
Upvotes: 2
Views: 2062
Reputation: 4033
Yes by creating object of google's Event class's type and then calling various methods for adding event to calendar :-
Event event = new Event();
event.setStart(new EventDateTime().setDateTime(start));
event.setEnd(new EventDateTime().setDateTime(end));
event.setSummary(eventEntity.getSummary());
event.setLocation(location);
event.setDescription(description);
after that calling following code to insert the event
calendarService.events().insert(appCalendarId, calendarEvent).execute();
here the calendarService is generated from google's credentials that we get after successful response from google api
Upvotes: 0
Reputation: 1323
I solved this issue as follows:
calendarClient.events().insert(appCalendarId, calendarEvent).execute();
Upvotes: 1