我在尝试向日历插入事件时遇到了问题。以下是我目前的代码,取自Google API帮助文档:
Event event = new Event();
event.setSummary("Appointment");
event.setLocation("Somewhere");
ArrayList<EventAttendee> attendees = new ArrayList<EventAttendee>();
attendees.add(new EventAttendee().setEmail("attendeeEmail"));
event.setAttendees(attendees);
Date startDate = new Date();
Date endDate = new Date(startDate.getTime() + 3600000);
DateTime start = new DateTime(startDate, TimeZone.getTimeZone("UTC"));
event.setStart(new EventDateTime().setDateTime(start));
DateTime end = new DateTime(endDate, TimeZone.getTimeZone("UTC"));
event.setEnd(new EventDateTime().setDateTime(end));
service.events().insert("primary", event).execute();
除了我仍在不断收到
Exception in thread "main"
com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
"message" : "Invalid Value"
我做错了什么?