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.
What would be the right code to get my answer?
employee
is a array of objects and contains only 1 object with index 0
. So, use
employee[0].title
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.