2017-01-26 68 views
1

我能列出從默認的谷歌日曆事件,但試圖從其他日曆列表中的事件的時候,我得到了錯誤:如果外部日曆不支持是否可以從外部日曆查詢事件?

PHP Fatal error: Uncaught exception 'Google_Service_Exception' with message '{ 
"error": { 
    "errors": [ 
    { 
    "domain": "global", 
    "reason": "notFound", 
    "message": "Not Found" 
    } 
    ], 
    "code": 404, 
    "message": "Not Found" 
} 
} 

我不知道,還是我這些外部消息的錯誤ID。我使用這種方法CalendarList: list來查詢我帳戶中的所有可用日曆,但只有第一個可用(我的默認)。我不知道這是否是獲得ID的正確方法:

$calendarList = $service->calendarList->listCalendarList(); 

while(true) { 
    foreach ($calendarList->getItems() as $calendarListEntry) { 
    echo $calendarListEntry->getSummary(); 
    echo "\r\n"; 
    } 
    $pageToken = $calendarList->getNextPageToken(); 
    if ($pageToken) { 
    $optParams = array('pageToken' => $pageToken); 
    $calendarList = $service->calendarList->listCalendarList($optParams); 
    } else { 
    break; 
    } 
} 
+0

我做的,意思是正下方的錯誤代碼 – Casper

+0

日曆的ID從ID字段中的電子郵件地址,而不是總結。 – luc

回答

2

我創建了一個測試場景:一個電子郵件CalendarList: get沒有正確共享的日曆的一個授權調用的函數。

enter image description here

然後,我分享與用戶日曆發出API請求:

enter image description here

敬請留意的是:

enter image description here

如果您正在歌廳事件清單,您應該嘗試使用Events: list

希望這些信息對您有所幫助。

相關問題