簡體   English   中英

Google Calendar API事件插入

[英]Google Calendar API Event Insertion

我在嘗試將事件插入日歷時遇到問題。 這是我到目前為止的代碼,取自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"

我究竟做錯了什么?

你試過這個嗎?

attendees.add(new EventAttendee().setEmail("attendeeEmail@bla.com"));

我重現了這個錯誤:似乎谷歌檢查電子郵件的@符號。 添加@ bla.com解決了它。 沒有更多400錯誤請求

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM