Google api 如何向域的所有用户添加谷歌日历?

Google api 如何向域的所有用户添加谷歌日历?,google-api,google-calendar-api,google-apps,google-api-ruby-client,Google Api,Google Calendar Api,Google Apps,Google Api Ruby Client,我很难弄清楚如何将日历添加到域的所有用户的日历列表 到目前为止,我可以成功地创建日历并创建一个域范围的ACL,但我不知道如何将日历插入域用户列表 使用ruby客户端API,它看起来像这样: client = Google::APIClient.new service = client.discovered_api("calendar", "v3") calendar_response = JSON.parse(client.execute(:api_method => service.c

我很难弄清楚如何将日历添加到域的所有用户的
日历列表

到目前为止,我可以成功地创建
日历
并创建一个域范围的
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" })
这一切都很好。它创建日历并与域中的每个人共享。我搞不懂的是如何将它显式地添加到用户的日历列表中

要添加到单一授权用户的日历列表,如下所示:

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

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

如果是这样,可以用一个命令完成,还是需要用每个用户id打电话? 您必须为每个用户id打电话

如果需要为每个用户执行命令,如何获取用户ID?
要检索用户id,首先必须使用Admin SDK API列出域中的所有用户,然后针对日历中的每个INSERT命令更改电子邮件地址的用户id。

我在文档中看到,GTLRCalendar\u AclRule\u范围选项之一是“域”。那么,是否有可能为域中的所有用户获取日历邀请?