Google Calendar v3 Java API:插入事件

时间:2013-05-16 12:13:53

标签: java google-calendar-api

我正在尝试通过java API将事件插入到Google日历中: CalendarTest

我想跑:

new Calendar.Events.Insert(calendarId, content).execute();

除了构造函数受到保护,我找不到静态公共 进行插入的方法。有什么建议吗?

2 个答案:

答案 0 :(得分:1)

我解决了这个问题如下:

calendarClient.events().insert(appCalendarId, calendarEvent).execute();

答案 1 :(得分:0)

是的,通过创建Google的Event类的类型对象,然后调用各种方法将事件添加到日历: -

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);

之后调用以下代码来插入事件

calendarService.events().insert(appCalendarId, calendarEvent).execute();

此处,calendarService是根据我们从google api成功回复后获得的Google凭据生成的

相关问题