2

我无法确定如何将日历添加到域的所有用户的'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?

回答

1

如果我作为域管理员身份验证,是否可以为所有用户创建CalendarList项目? 不,你不能:(。

如果是的话,可以把它用一个命令来实现还是需要拨打电话与每一个用户ID? 你必须为每个用户通话ID。

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

相关问题