登录
首页 >  Golang >  Go问答

无法发送更新:使用谷歌日历 API 时的“SendUpdates”问题

来源:stackoverflow

时间:2024-02-09 20:57:25 465浏览 收藏

一分耕耘,一分收获!既然都打开这篇《无法发送更新:使用谷歌日历 API 时的“SendUpdates”问题》,就坚持看下去,学下去吧!本文主要会给大家讲到等等知识点,如果大家对本文有好的建议或者看到有不足之处,非常欢迎大家积极提出!在后续文章我会继续更新Golang相关的内容,希望对大家都有所帮助!

问题内容

我正在使用 golang

我正在尝试使用 google-calendar-api 向参与者发送通知。

我尝试了 calendar 包文档中的一些功能,其中提到了通过电子邮件发送通知。 (例如:sendnotificationssendupdates

但是它们都不起作用。

我已将与会者附加到 event 结构中,以便这些电子邮件所有者可以自己在日历板上看到邀请,但不会收到任何电子邮件。

我的代码部分:

创建事件即时:

event := &calendar.event{
        summary:     "google calendar test",
        location:    "800 howard st., san francisco, ca 94103",
        description: "go hiking!",
        start: &calendar.eventdatetime{
            datetime: "2022-01-05t10:00:00",
            timezone: "asia/taipei",
        },
        end: &calendar.eventdatetime{
            datetime: "2022-01-05t11:00:00",
            timezone: "asia/taipei",
        },
        attendees: []*calendar.eventattendee{
            &calendar.eventattendee{email: "[email protected]"},
        },
}

插入事件:

calendarId := "primary"
    event_notification := srv.Events.Insert(calendarId, event).SendUpdates("all")
    event, err = event_notification.Do()

正确答案


[解决]

对我来说,答案非常直接(而且愚蠢)。

由于我依赖谷歌云平台及其api(其中oauth的publish状态已被我配置为“测试阶段”),我认为它要求与会者也是测试用户所有相关的事情都要做。

只需输入您的

Google cloud platform
->hit on the Navigation Menu at the left top
->API's & Services
->OAuth consent screen

然后单击 test users 部分下的 + add users, 然后,输入参与项目的与会者的电子邮件。

到这里,我们也就讲完了《无法发送更新:使用谷歌日历 API 时的“SendUpdates”问题》的内容了。个人认为,基础知识的学习和巩固,是为了更好的将其运用到项目中,欢迎关注golang学习网公众号,带你了解更多关于的知识点!

声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>