Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function updateUser() {
- // update individual user, given email, to make Site Code match buildingId
- const user1Email = "[email protected]";
- const user2Email = '[email protected]';
- try {
- var user = AdminDirectory.Users.get(user2Email,{projection: 'custom',customFieldMask: 'Site_Code'});
- //user.customSchemas.User_Information.Site_Code = user.locations[0].buildingId;
- //AdminDirectory.Users.update(user, userEmail);
- AdminDirectory.Users.update({
- 'customSchemas': {
- 'User_Information': {
- 'Site_Code': [
- { value: 'blooptest', type: 'work' },
- ]
- }
- }
- },
- user1Email
- )
- Logger.log("user1: " + user.primaryEmail + "," + user.locations[0].buildingId + "," + user.customSchemas.User_Information.Site_Code);
- } catch (err) {
- // TODO (developer)- Handle exception from the API
- console.log('Failed with error %s', err.message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment