I'm trying to delete a User from our Google domain (G Suite for Education) with Google script inside a Drive-Project. I'm logged on as the 'super-admin', have activated APIs for the Project etc. I can create users, add group membership, set OU-path etc.
When I try to delete a test user with the same Project I'm "not authorized"?
var userEmail = '[email protected]';
var user = AdminDirectory.Users.get(userEmail);
user = AdminDirectory.Users.remove(user);
Logger.log('User: ' + userEmail + ' deleted.');
Sorry if this is a stupid question! I'm a Google script-beginner. ;-)