如何将Google日历添加到域的所有用户? [英] How do you add a Google Calendar to all users for a domain?
问题描述
我无法确定如何将日历添加到所有域用户的 CalendarList
中。
到目前为止,我可以成功创建日历
并创建一个域范围 ACL
,但我不知道如何插入日历到域用户的列表中。
使用ruby客户端API它看起来像这样:
client = Google :: APIClient.new
service = client.discovered_api(calendar,v3)
calendar_response = JSON.parse(客户端。执行(:api_method => service.calendars.insert,
:body => JSON.dump({summary=>events}),
:headers => { Content-Type=>application / json})。response.body)
rule = {
scope=> {
type=> 域,
值=>域,
},
角色=> author
}
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=>假,
selected=> true
}
calendar_list_result = client.execute(:api_method => service.calendar_list.insert,
:body => JSON.dump(list_params),
:headers = > {Content-Type=>application / json})
/ p>
- 如果我作为域管理员进行身份验证,是否可以为所有人创建
CalendarList
项用户? - 如果是这样,可以使用单个命令完成,还是需要与每个用户ID进行通话?
- 如果我需要为每个用户执行一个命令,我如何获取用户标识符? 如果我作为域管理员身份验证,是否可以为所有用户创建CalendarList项目?
否,您不能:(。
如果是这样,是可以使用单个命令完成,还是需要使用每个用户ID拨打电话?
您必须为每个用户ID拨打电话。 p>
如果我需要为eac执行命令h用户,我如何获取用户标识符?
要检索用户标识符,首先必须使用Admin SDK API列出域中的所有用户, https://developers.google.com/admin-sdk/directory/v1/guides/manage-users #get_all_domain_users ,然后为日历中的每个INSERT命令更改用户标识,以获取电子邮件地址。
I am having trouble figuring out how to add a calendar to all of a domain's users' CalendarList
.
So far I can successfully create the Calendar
and create a domain wide ACL
but I don't know how to insert the calendar into domain users' lists.
Using the ruby client API it looks something like this:
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" })
This all works fine. It creates the calendar and it is shared with everyone in the domain. What I can't figure out is how to explicitly added it to the users' list of Calendars.
To add to the single authed user's calendar list would look like this:
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" })
Questions:
- If I am authenticated as a domain admin, can I create
CalendarList
item for all users? - If so, can it be done with a single command or do I need to make a call with every user id?
- If I need to do a command for each user, how do I get the user ids?
If I am authenticated as a domain admin, can I create CalendarList item for all users? No you can't :(.
If so, can it be done with a single command or do I need to make a call with every user id? You have to make a call for each user id.
If I need to do a command for each user, how do I get the user ids? To retrieve the user id you first must list all the users in the domain with the Admin SDK API, https://developers.google.com/admin-sdk/directory/v1/guides/manage-users#get_all_domain_users , then for each INSERT command in the calendar you change the user id, for the email address.
这篇关于如何将Google日历添加到域的所有用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!