【发布时间】:2020-04-18 07:23:38
【问题描述】:
我目前正在从 google-calendar-api (api reference) 实现插入功能,但在成功创建事件后,它永远不会出现在非 gmail 帐户上(例如 ...@icloud. com)。在使用 api-explorer 进行测试时也是如此。它只会默默地出现在 gmail-accounts 中。
我已将 sendNotifications 设置为 true 并将 sendUpdates 设置为 all。没有发出邀请,是的,我检查了垃圾邮件目录。我已经在这个问题上坐了几天了,这让我难以置信,这不起作用。该服务目前无法使用,因为我无法使用非 gmail 地址添加与会者。
我一直在关注文档,尝试了 api-explorer,还测试了 node.js-library 以及普通的 http-requests。
如前所述,邀请/非 gmail 帐户甚至无法与 api-explorer 一起使用。如何修复此错误?
编辑 1:
Typescript中调用相应api的函数。 oAuth2Client 被正确初始化。 googleapis 是版本 48.0.0。开始和结束时间是格式正确的字符串,因为事件已成功创建但没有通知。
export async function createGoogleCalendarEntry(
uid: string,
props: CreateGoogleCalendarEntryProps,
context: CallableContext
): Promise<CreateCalendarEntryRes<CreateGoogleCalendarEntryRes>> {
const { title, start, end, attendees, desc } = props;
const oAuth2Client = await getAuthnAuthzGcpOAuth2ClientFromCallableContext(uid, context, c => c.gcp!);
return google
.calendar({ version: "v3", auth: oAuth2Client })
.events.insert({
calendarId: "primary",
sendUpdates: "all",
sendNotifications: true,
requestBody: {
summary: title,
description: desc,
start: { dateTime: start },
end: { dateTime: end },
attendees: attendees.map(a => ({ email: a.mail }))
}
})
.then(res => ({
provider: "google",
externalCalId: res.data.id!,
meta: res.data as CreateGoogleCalendarEntryRes
}));
}
【问题讨论】:
-
请分享您的代码。
-
您好 Rafa,感谢您查看我的问题。我已经更新了帖子以包含代码。
标签: google-calendar-api google-apis-explorer