2016-04-03 39 views
1

我試圖從我的日曆中獲取繁忙的空閒時間。 這裏是我的代碼:無法從freebusy查詢檢索日曆數據

var freeRequest = gapi.client.calendar.freebusy.query({ 
    timeMin: (new Date(2016, 3, 1)).toISOString(), 
    timeMax: (new Date(2016, 3, 30)).toISOString() 
}); 

freeRequest.execute(function(resp) { 
    console.log(resp); 
}); 

它,因爲我從here得到返回相同的結果。在這兩種情況下,我都沒有收到任何日曆。這是我得到的迴應:

{ 
    "kind": "calendar#freeBusy", 
    "timeMin": "2016-05-01T04:00:00.000Z", 
    "timeMax": "2016-05-30T05:00:00.000Z" 
} 

回答

1

項目添加到您的要求是這樣的:

var freeRequest = gapi.client.calendar.freebusy.query({ 
    items: [ 
     {id: "calendar id"} 
    ], 
    timeMin: (new Date(2016, 3, 1)).toISOString(), 
    timeMax: (new Date(2016, 3, 30)).toISOString() 
}); 

日曆ID都可以找到像this