2013-04-03 32 views
1

我正在使用google-api-php-client-0.6.1(API v3)從服務帳戶的共享(非主要)日曆中列出/獲取事件?我能夠讓通過API請求使用這些設置:如何使用google api php客戶端庫爲服務帳戶列出/獲取來自共享(非主要)日曆的事件?

client id: xxx.apps.googleusercontent.com 
service account name: [email protected] 
my google account is: [email protected] 

和我所試圖做的是插入/列表/得到日曆事件[email protected]

當我這樣做,它的工作原理:

$events = $service->events->listEvents('primary'); 

然而,當我做到以下幾點,這是行不通的:

$events = $service->events->listEvents('[email protected]'); 

,我得到一個錯誤「無效的JSON服務響應「,任何人都可以提供任何幫助?


(也張貼了我在google group問題)

+0

嗨,有人可以請幫助上述問題? – yap

回答

1

的電子郵件地址可以有很多與之相關的日曆。 listEvents()接受其中一個日曆ID作爲參數。

如果您轉到日曆的設置,可以在底部看到類似「日曆ID:[email protected]」的「日曆地址」。

+0

感謝allicarn,我試圖把日曆id作爲參數:$ service-> events-> insert(CALENDAR_ID,$ event);但仍然顯示錯誤,您或任何人都可以幫助解決這個問題?在此先感謝.. – yap

+0

我不確定,看起來您的文檔符合文檔(https://developers.google.com/google-apps/calendar/v3/reference/events/insert#examples> PHP)。我會嘗試使用和不使用「@ group.calendar.google.com」。 – allicarn

+0

如果此答案適用於'listEvents()',請將其標記爲接受的答案? – allicarn

相關問題