Fra*_*nk 0 google-apps-script google-admin-sdk
我正在使用示例脚本来创建用户,但它不断收到此错误 ReferenceError: "AdminDirectory" is not defined
/**
* Adds a new user to the domain, including only the required information. For
* the full list of user fields, see the API's reference documentation:
* @see https://developers.google.com/admin-sdk/directory/v1/reference/users/insert
*/
function addUser() {
var user = {
primaryEmail: 'liz@mydomain.com',
name: {
givenName: 'Elizabeth',
familyName: 'Smith',
},
// Generate a random password string.
password: Math.random().toString(36),
};
user = AdminDirectory.Users.insert(user);
Logger.log('User %s created with ID %s.', user.primaryEmail, user.id);
}
Run Code Online (Sandbox Code Playgroud)
您需要在 2 个地方启用 API。
归档时间: |
|
查看次数: |
3156 次 |
最近记录: |