简体   繁体   English

GO:“SendUpdates”在使用谷歌日历时不起作用 API

[英]GO : "SendUpdates" not working when using google calendar API

I'm using GOLANG .我正在使用GOLANG

I'm trying to use google-calendar-API to send notification to participants.我正在尝试使用google-calendar-API向参与者发送通知。

I tried some functions in the document of the calendar package which mentioned about sending notification via email.我在calendar package 的文档中尝试了一些功能,其中提到了通过 email 发送通知。 (eg: SendNotifications & SendUpdates ) (例如: SendNotifications & SendUpdates

But none of them worked.但他们都没有工作。

I've attached attendees inside the event structure so those email owners can see the invitation at the calendar board themselves, but does not receive any email.我已在event结构中附加了与会者,因此那些 email 所有者可以自己在日历板上看到邀请,但不会收到任何 email。

My part of code:我的部分代码:

create event instant:创建事件即时:

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: "TESTINGGMAIL@gmail.com"},
        },
}

insert events:插入事件:

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

[Solve] [解决]

The answer for me is quite directly(and dumb).对我来说,答案很直接(而且很愚蠢)。

Since I'm relying on the google cloud platform with their API( which the publish status of OAuth has been configured to be the "testing stage" by me ), I think it requires the attendees to also be a Test user for all relative things to be done.由于我依靠谷歌云平台及其 API(OAuth 的publish status已被我配置为“测试阶段”),我认为它要求与会者也是所有相关事物的Test user要完成。

Simply enter your只需输入您的

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

and click on the + ADD USERS under the Test users section, then, type in the emails of attendees presenting in the project.并单击“ Test users ”部分下的+ ADD USERS ,然后输入项目中出席者的电子邮件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM