将Freebusy用于除主要'之外的其他日历。

时间:2017-08-22 15:01:20

标签: python api google-calendar-api

我正在为非主日历创建活动,我想检查用户是否在此日历中不忙,而不是在此活动的主要日历中。

我的查询:

the_datetime = tz.localize(datetime.datetime(2016, 1, 3, 0))
the_datetime2 = tz.localize(datetime.datetime(2016, 1, 4, 8))
body = {
        "timeMin": the_datetime.isoformat(),
        "timeMax": the_datetime2.isoformat(),
        "timeZone": 'US/Central',
        "items": [{"id": 'my.email@gmail.com'}]
       }
eventsResult = service.freebusy().query(body=body).execute()

它返回:

{'calendars': {'my.email@gmail.com': {'busy': []}},
 'kind': 'calendar#freeBusy',
 'timeMax': '2016-01-04T14:00:00.000Z',
 'timeMin': '2016-01-03T06:00:00.000Z'}

即使我在X日历中创建了该日期的内容,但是当我在主日历中创建活动时,我有:

{'calendars': {'my.email@gmail.com': {'busy': [{'end': '2016-01-03T07:30:00-06:00',
     'start': '2016-01-03T06:30:00-06:00'}]}},
 'kind': 'calendar#freeBusy',
 'timeMax': '2016-01-04T14:00:00.000Z',
 'timeMin': '2016-01-03T06:00:00.000Z'}

有没有办法告诉API我要检查的日历?

1 个答案:

答案 0 :(得分:1)

我发现了! :d

在正文项目中,输入日历ID而不是邮件