简体   繁体   English

如何从管理员目录中获取员工职位?

[英]How get the Employee Title from Admin Directory?

I'm expecting to get the job title of the user via using google app script, but I'm getting the log print as follows我希望通过使用谷歌应用程序脚本获得用户的职位,但我得到的日志打印如下

[20-11-17 12:31:35:307 IST] [{title=Manager, department=Marketing, primary=true, customType=}]

The below is my code下面是我的代码

function getUserDirectory(){
var user = Session.getActiveUser().getEmail();
var employee = AdminDirectory.Users.get(user).organizations;
Logger.log(employee);
}

What I'm trying to do is get only the title of the employee.我想做的是只获得员工的头衔。 I've tried adding [1] or [2] or [3] after the .orgainizations object but it doesn't work.我试过在 .orgainizations 对象后添加 [1] 或 [2] 或 [3],但它不起作用。

What would be the right code to get my answer?得到我的答案的正确代码是什么?

employee is a array of objects and contains only 1 object with index 0 . employee是一个对象数组,只包含 1 个索引为0对象。 So, use所以,使用

employee[0].title

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

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