[英]How get the Employee Title from Admin Directory?
我希望通过使用谷歌应用程序脚本获得用户的职位,但我得到的日志打印如下
[20-11-17 12:31:35:307 IST] [{title=Manager, department=Marketing, primary=true, customType=}]
下面是我的代码
function getUserDirectory(){
var user = Session.getActiveUser().getEmail();
var employee = AdminDirectory.Users.get(user).organizations;
Logger.log(employee);
}
我想做的是只获得员工的头衔。 我试过在 .orgainizations 对象后添加 [1] 或 [2] 或 [3],但它不起作用。
得到我的答案的正确代码是什么?
employee
是一个对象数组,只包含 1 个索引为0
对象。 所以,使用
employee[0].title
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.