Google Calendar API-共享日历

kub*_*uba 6 google-calendar-api

是否可以使用Google API与某人(添加或删除用户)特定的Google日历共享?

我有50多个日历,每个日历都有不同的人来更新数据,例如,我想创建“更新窗口”。他们只能在星期一更新活动。

小智 5

这是一个老问题,但如果有人想使用日历,这里是如何与用户共享日历:这是由ACL完成的 这是 php 中的示例:

public function sharecalendarwithuser($calendar_id, $user_email, $role)
{
    $rule = new Google_Service_Calendar_AclRule();
    $scope = new Google_Service_Calendar_AclRuleScope();
    /*
    The type of the scope. Possible values are:

        "default" - The public scope. This is the default value.
        "user" - Limits the scope to a single user.
        "group" - Limits the scope to a group.
        "domain" - Limits the scope to a domain.
    */
    $scope->setType("user");
    $scope->setValue($user_email);
    $rule->setScope($scope);
    /*
    The role assigned to the scope. Possible values are:
        "none" - Provides no access.
        "freeBusyReader" - Provides read access to free/busy information.
        "reader" - Provides read access to the calendar. Private events will appear to users with reader access, but event details will be hidden.
        "writer" - Provides read and write access to the calendar. Private events will appear to users with writer access, and event details will be visible.
        "owner" - Provides ownership of the calendar. This role has all of the permissions of the writer role with the additional ability to see and manipulate ACLs.
    */
    $rule->setRole($role);
    $createdRule = $service->acl->insert($calendar_id, $rule);
}
Run Code Online (Sandbox Code Playgroud)

希望这有帮助:)


小智 2

您可以通过查看 ACL 的 API 文档 - 访问控制列表 https://developers.google.com/calendar/v3/reference/acl