我無法確定如何將日曆添加到域的所有用戶的'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?