Google Apps Super Admin对域用户日历的访问权限

时间:2019-03-05 18:20:37

标签: google-calendar-api

我有大量的资源日历,我的用户需要根据他们的角色对它们进行不同程度的访问。我正在编写一个用于管理这些Acl规则的应用程序,但还希望管理哪些日历出现在最终用户的日历供稿中(即,我不想让它们突然看到所有130个资源日历并必须对其进行过滤)

我需要使用CalendarList api访问权限,但是当我传递用户// calendarList而不是使用Super Admin凭据授权的users / me / calendarList时,该服务将返回404响应。

我的目标是遍历共享日历资源的列表,并为阅读器或freeBusyReader的每个用户设置其calendarListEntry.hidden为true。

1 个答案:

答案 0 :(得分:0)

因此,我找到了答案。为了模拟用户,您必须在初始化服务帐户凭据时将“用户”设置为您要模拟的电子邮件地址:

public static ServiceAccountCredential Credential(string[] Scopes, string impersonateEmail = null) { ServiceAccountCredential cred = ServiceAccountCredential.FromServiceAccountData(credential_stream); var initializer = new ServiceAccountCredential.Initializer(cred.Id) { User = string.IsNullOrEmpty(impersonateEmail)?service_acct:impersonateEmail, Key = cred.Key, Scopes = Scopes }; return new ServiceAccountCredential(initializer); }

相关问题