Google日历api - 共享日历

时间:2012-03-26 11:19:07

标签: google-calendar-api

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

我有超过50个日历,并且每个人都有更新数据的不同的人,我想制作“更新窗口”,例如。他们只能在星期一更新活动。

2 个答案:

答案 0 :(得分:3)

您可以通过访问ACL的API文档 - 访问控制列表 https://developers.google.com/google-apps/calendar/v2/developers_guide_protocol#AddAcl

答案 1 :(得分:3)

这是一个老问题,但如果有人想要使用它,这里是如何与用户共享日历: 这是由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);
}

希望这有助于:)