我正在使用示例脚本来创建用户,但始终出现此错误 ReferenceError:未定义“ AdminDirectory”
/**
* 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);
}