1

需要一些帮助GAS一个用户目录简介..返回与谷歌Apps脚本管理SDK

我试图返回的用户列表,并使用管理SDK 使用谷歌Apps脚本和目录及其部门Admin SDK中的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

返回部门如果我使用 网友[我] .organizations 然后返回在组织该用户所有的可用条目。

Ex。

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

我需要返回只是 '部门'

预先感谢您!

回答

1

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