如何在App-Script中添加多个用户属性?
我正在自动化组织中的入职过程,并具有与App-Script相连的Google表单。 但我想添加更多属性,例如经理的名称,部门,电话号码
等
var user = {
"primaryEmail": email,
"name": {
"givenName": givenName,
"familyName": familyName
},
"relations": [{
"value": manager,
"type": manager,
}],
"password": password,
};
console.log(password);
try {
user = AdminDirectory.Users.insert(user);
console.log('User %s created with ID %s.', user.primaryEmail, user.id);
} catch (err) {
console.log('Failed with error %s', err.message);
}
用户正在Google Admin中创建, 以下错误:(
Failed with error API call to directory.users.insert failed with error: Invalid value for: TEST is not a valid value
对于上下文,我以表格为经理的价值进行了测试)
请让我知道我在做错了什么,以便我可以解决此问题。 谢谢!
I am automating the onboarding process in our organization and have a google form connected with app-script. The user is getting created in google admin but I would like to add more attributes such as Manager's name, Department, phone number etc.
Here is the API method:
var user = {
"primaryEmail": email,
"name": {
"givenName": givenName,
"familyName": familyName
},
"relations": [{
"value": manager,
"type": manager,
}],
"password": password,
};
console.log(password);
try {
user = AdminDirectory.Users.insert(user);
console.log('User %s created with ID %s.', user.primaryEmail, user.id);
} catch (err) {
console.log('Failed with error %s', err.message);
}
But as of now, there is something wrong with the manager code because I get the following error:
Failed with error API call to directory.users.insert failed with error: Invalid value for: TEST is not a valid value
(For context, I had put in TEST as the manager's value in the form)
Please let me know what I am doing wrong so I can fix this.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过文档在这里
有关关系值类型:
类型接受值:
admin_assistant,助理,兄弟,孩子,定制,foree toury_partner,dotted_line_manager,exec_assistant,父亲,朋友,朋友,经理,母亲,父母,父母,伴侣,伴侣,reflerred_by,亲戚,姐妹,配偶
自定义:让您添加自定义值。
在入职场景中,可以实现此功能来为此用户指定经理的电子邮件地址:
=“ https://i.sstatic.net/qqffrd.png”
After going through the documentation here it states:
As for relation value types:
type accepts values:
admin_assistant, assistant, brother, child, custom, domestic_partner, dotted_line_manager, exec_assistant, father, friend, manager, mother, parent, partner, referred_by, relative, sister, spouse
Custom: Let's you add custom values.
In the onboarding scenario, this can be implemented to specify the manager's email address for this user:
And this succeeds: