我无法弄清楚如何将日历添加到域的所有用户的 CalendarList

到目前为止,我可以成功创建 Calendar 并创建一个域范围的 ACL,但我不知道如何将日历插入域用户列表中。

使用 ruby​​ 客户端 API,它看起来像这样:

client = Google::APIClient.new
service = client.discovered_api("calendar", "v3")

calendar_response = JSON.parse(client.execute(:api_method => service.calendars.insert,
  :body => JSON.dump({"summary" => "events"}),
  :headers => { "Content-Type" => "application/json" }).response.body)

rule = {
  "scope" => {
    "type" => "domain",
    "value" => domain,
  },
  "role" => "writer"
}
acl_result = client.execute(:api_method => service.acl.insert,
  :parameters => { "calendarId" => calendar_response["id"] },
  :body => JSON.dump(rule),
  :headers => { "Content-Type" => "application/json" })

这一切正常。它创建日历并与域中的每个人共享。我无法弄清楚如何将其明确添加到用户的日历列表中。

要添加到单个经过身份验证的用户的日历列表,如下所示:
list_params = {
  "calendarId" => calendar_response["id"],
  "hidden" => false,
  "selected" => true
}
calendar_list_result = client.execute(:api_method => service.calendar_list.insert,
  :body => JSON.dump(list_params),
  :headers => { "Content-Type" => "application/json" })

问题:
  • 如果我被认证为域管理员,我可以为所有用户创建 CalendarList 项目吗?
  • 如果是这样,是否可以使用单个命令完成,或者我是否需要使用每个用户 ID 进行调用?
  • 如果我需要为每个用户执行一个命令,我如何获取用户 ID?
  • 最佳答案

    如果我被认证为域管理员,我可以为所有用户创建 CalendarList 项目吗?
    不,你不能:(。

    如果是这样,是否可以使用单个命令完成,或者我是否需要使用每个用户 ID 进行调用?
    您必须为每个用户 ID 进行调用。

    如果我需要为每个用户执行一个命令,我如何获取用户 ID?
    要检索用户 ID,您首先必须使用 Admin SDK API https://developers.google.com/admin-sdk/directory/v1/guides/manage-users#get_all_domain_users 列出域中的所有用户,然后针对日历中的每个 INSERT 命令更改用户 ID,作为电子邮件地址。

    关于google-api - 如何向域的所有用户添加 Google 日历?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15146146/

    10-14 18:32
    查看更多