简体   繁体   中英

GO : "SendUpdates" not working when using google calendar API

I'm using GOLANG .

I'm trying to use google-calendar-API to send notification to participants.

I tried some functions in the document of the calendar package which mentioned about sending notification via email. (eg: 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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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