因此,Google Apps 脚本允许您getCalendarByID、getCalendarsByName和getDefaultCalendar,当您需要定位特定日历时,这非常有用。但是,我想知道是否有办法获取与该帐户关联的所有日历?
我已经尝试过getCalendarsByName(),getCalendarsByName('')并且getCalendarsByName('*')都不起作用。
在我的程序中,我使用 google-api-python-client 连接到日历 API。我通过以下方式查询未来 3 天的事件:
service = build(serviceName='calendar', version='v3', http=http)
events = service.events().list(
calendarId=calendarId,
timeMin='2013-01-04T00:00:00+01:00',
timeMax='2013-01-06T00:00:00+01:00').execute()
Run Code Online (Sandbox Code Playgroud)
结果是一个事件列表,在 Python 字典中建模,大致如下(我省略了一些不必要的数据):
{
u'created': u'2012-11-26T00:54:43.000Z',
u'description': u'abc abc',
u'start': {u'dateTime': u'2012-11-26T08:00:00+01:00',
u'timeZone': u'Europe/Copenhagen'},
u'end': {u'dateTime': u'2012-11-26T10:00:00+01:00',
u'timeZone': u'Europe/Copenhagen'},
u'kind': u'calendar#event',
u'recurrence': [u'RRULE:FREQ=DAILY'],
u'sequence': 0
}
Run Code Online (Sandbox Code Playgroud)
上述事件是一个重复事件,在几个月前创建,“开始”和“结束”字段反映了创建日期。结果列表中将存在此事件的多个副本,因为它在“timeMin”和“timeMax”范围之间发生多次。
现在,问题是我没有事件确切发生的日期时间(在本例中应该是 2013-01-04T00:08:00+01:00)。有人知道我是否可以从 Google Calendar API 获取该时间(我通过他们的 python 包使用版本 3)?
或者建议如何在客户端实现它?
从文档(https://developers.google.com/google-apps/calendar/v3/sync):
有时同步令牌会因各种原因被服务器失效,包括令牌过期或相关 ACL 的更改。在这种情况下,服务器将使用响应代码 410 响应增量请求。这应该触发客户端存储的完全擦除和新的完全同步。
我需要模拟 410 错误。有没有办法设置同步令牌到期日期?我尝试更改日历的访问控制数据,但同步令牌并未失效。
Google 没有关于如何删除 node.JS 中的事件的文档
我已经能够使用以下代码将新事件添加到我的日历中:
calendar.events.insert({
auth: auth,
calendarId: 'primary',
resource: event,
}, function(err, event) {
if (err) {
console.log('There was an error contacting the Calendar service: ' + err);
return;
}
console.log('Event created: %s', event.htmlLink);
});
Run Code Online (Sandbox Code Playgroud)
我已经摆弄了 4 个小时了,正在寻找解决方案。
我正在尝试使用 Angular 5 连接到 Google Calendar API,以便我可以在我正在构建的 Web 应用程序上显示即将发生的事件。我是 Angular 的新手,我正在寻找一种将 API 集成到我的应用程序中的方法。我搜索了很多,但我没有找到一种方法来做到这一点。
我知道有很多关于这个问题的请求;但他们似乎都没有回答我的问题。为了自动生成 Google 日历约会,包括自动生成相应的 Google Meet 链接,我执行了以下操作:
JSON,比方说access.json。
putenv('GOOGLE_APPLICATION_CREDENTIALS=my/key/data/directoy/access.json');
$client = new Client();
$client->useApplicationDefaultCredentials();
$client->addScope(Google_Service_Calendar::CALENDAR);
$client->setSubject("{address_explained_below}");
// Set up the Calendar API service
$service = new Google_Service_Calendar($client);
// Create a new event on Google Calendar
$event = new Google_Service_Calendar_Event(
[
'summary' => 'Meeting',
'start' => …Run Code Online (Sandbox Code Playgroud) 我发现了这个非常棒的脚本,可以同步Google Cal和Google电子表格。双向同步。而且有效!-> https://github.com/Davepar/gcalendarsync
现在,我无法将日历的地址放在名为Data的工作表中。在单元格B1中。脚本应该从那里拉地址,这样我就不需要在脚本中更改它。
有人可以弄清楚该怎么做吗?
更改将涉及通过Data!B1来定义calendarId
并且脚本应仅在工作表上运行
您可以在此处查看示例文档:https : //docs.google.com/spreadsheets/d/1TCIIBRmshx2kmhhwrhCpg5sxO7N82tOJ7hHxWv_u-Yw/edit? usp =sharing
我在工作表脚本上复制了脚本