繁体   English   中英

使用Google Apps脚本上的Admin SDK返回用户目录配置文件

[英]Returning a users directory profile with the Admin SDK on Google Apps Script

需要一些GAS帮助。

我正在尝试使用ADMIN SDK(使用Google Apps脚本和Admin SDK中的Directory API)返回用户及其部门的列表。

if (users) {
  for (var i = 0; i < users.length; i++) {
    var user = users[i];
    values.push([users[i].primaryEmail, users[i].orgUnitPath, users[i].organizations.department]);
  }

我无法弄清楚返回Organizations.department中的部门的语法

如果我使用users [i] .organizations,则它将返回该用户在组织中的所有可用条目。

防爆。

[{title=Student, location=3, customType=work, department=School, primary=true, name=School District}] 

我只需要返回“部门”

先感谢您!

根据我的理解,没有办法直接让部门工作。 您需要迭代每个组织条目才能获得部门。 在字段文本字段中查看 ,您可以选择要在输出中看到的字段(响应)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM