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?
我解决了这个问题,如下所示:
calendarClient.events().insert(appCalendarId, calendarEvent).execute();
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.