使用Google Apps脚本向Google日历添加非Gmail用户的问题

时间:2017-09-17 02:22:24

标签: google-apps-script google-calendar-api

我自动将成员添加到Google日历时遇到问题。

我的功能是:

function addToCalendar(email, calendar) {
    // Create a user with read/write access to calendar
    var resource = {
        scope: {
            type: 'user',
            value: email
        },
        role: 'writer'
    };

    Calendar.Acl.insert(resource, calendar);
}

此功能适用于Gmail帐户,但无法与非Gmail帐户一起使用。非Gmail帐户仍会列在日历中添加,但无法访问日历。

我认为问题源于需要Gmail帐户的Google日历。手动尝试添加用户时,会出现以下提示:

截图:

enter image description here

有没有办法通过Google Apps脚本复制此邀请,或者解决此问题的方法?

感谢任何帮助。

由于

1 个答案:

答案 0 :(得分:0)

根据我的经验,您使用的是Google日历API的ACL规则。

所以,你的功能代码是正确的,但要确保一件事。 您可以通过将此功能用于其他用户来控制您的Google日历。因此,其他用户必须拥有Google帐户。因为当您向其他用户授予此访问权限时,您的共享日历将显示在他的日历用户界面中。

enter image description here

以下是共享的绿色突出显示的屏幕截图日历,它看起来像这样。

1)对于日历,Google帐户是必需的。 2)对于活动,您可以将与会者添加到Gmail或非Gmail帐户。

相关问题