我无法确定如何将日历添加到域的所有用户的'CalendarList
。如何将Google日历添加到域的所有用户?
到目前为止,我可以成功创建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" })
这一切工作正常。它创建日历,并与域中的每个人共享。我无法弄清楚的是如何明确地将其添加到用户的日历列表中。
为了增加单authed用户的日历表是这样的:
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?