Google日历活动制作会发送通知

时间:2014-02-28 18:07:00

标签: javascript google-api google-calendar-api

我想知道是否有人知道如何在谷歌日历中通过事件创建来通知与会者。当我手动创建活动时,我可以按照自己的意愿发送活动。但是当我使用带有javascript客户端库的api创建事件时。我没有收到电子邮件通知。

以下是我的创作代码:

var request = gapi.client.calendar.events.insert({
    'calendarId': '***@***.com',
    'resource': resource
});
request.execute(function() {
});

我的资源变量已经定义,并且该事件已成功添加到日历中,但没有与会者收到任何邀请。如果我在创建日历后进入日历活动,与会者就在那里。

请求中是否有任何遗漏,以便与会者在创建时收到通知。

4 个答案:

答案 0 :(得分:4)

与会者数组有一个responseStatus,您可以将其设置为: “needsAction” - 与会者尚未回复邀请。 “拒绝” - 与会者拒绝了邀请。 “暂定” - 与会者暂时接受了邀请。 “接受” - 与会者已接受邀请。

var request = gapi.client.calendar.events.insert({
  'calendarId': '***@***.com',
  'resource': resource,
  'attendees': [{'email':'example@example.com','responseStatus':'needsAction'}]
  }
});
request.execute(function() {
});

答案 1 :(得分:2)

您必须将参数“sendNotifications”设置为true。 在这里,您可以看到默认设置为false。 https://developers.google.com/google-apps/calendar/v3/reference/events/insert

答案 2 :(得分:1)

在iOS版本的API上,sendNotifications属性位于请求对象上 - 因此您需要先创建请求,然后在执行之前设置sendNotifications属性。查看请求对象,查看Java API是否相似(可能)。

e.g。 request.sendNotifications = true;

在打电话之前 request.execute()

答案 3 :(得分:1)

在Java客户端中有事件的insert方法,然后是setSendNotifications方法。 你必须做这样的事情:

Event createdEvent = calendario.events().insert("some-mail-from-google0@group.calendar.google.com", event).setSendNotifications(true).execute();
相关问题