Google Apps Script

Class NicknameManager

This class allows administrators to create, update, retrieve and delete nicknames in a Google Apps domain.

To use this class you have to first enable the Provisioning API on your domain.

Methods

MethodReturn typeBrief description
createNickname(username, nickname)DomainNicknameCreates a new nickname for the Google Apps domain user.
getAllNicknames()DomainNickname[]Retrieves the list of nicknames for the Google Apps domain.
getAllNicknames(username)DomainNickname[]Retrieves the list of nicknames for the given user.
getDomain()StringRetrieves the name of the domain being managed.
getNickname(nickname)DomainNicknameRetrieves information about a single nickname for the Google Apps domain.

Detailed documentation

createNickname(username, nickname)

Creates a new nickname for the Google Apps domain user. The user must already exist in the domain.

 
NicknameManager.createNickname('john.smith', 'johnny');
 

Parameters

NameTypeDescription
usernameStringthe user account for which we are creating a nickname
nicknameStringthe new nickname to be associated with the user account

Return

DomainNickname — the newly created user


getAllNicknames()

Retrieves the list of nicknames for the Google Apps domain.

 
// Logs all of the nicknames in the domain.
 var nicknames = NicknameManager.getAllNicknames();
 for (var i in nicknames) {
   Logger.log(nicknames[i].getNickname());
 }
 

Return

DomainNickname[] — an array of all of the domain's nicknames


getAllNicknames(username)

Retrieves the list of nicknames for the given user.

 
var userNicknames = NicknameManager.getAllNicknames("john.smith");
 

Parameters

NameTypeDescription
usernameStringthe user account for which we are retrieving the nicknames

Return

DomainNickname[] — an array of all of the user's nicknames


getDomain()

Retrieves the name of the domain being managed.

 
// Logs the name of the domain.
 Logger.log(NicknameManager.getDomain());
 

Return

String — the name of the domain being managed


getNickname(nickname)

Retrieves information about a single nickname for the Google Apps domain.

 
var nickname = NicknameManager.getNickname("johnny");
 

Parameters

NameTypeDescription
nicknameStringthe identifier associated with the nickname to retrieve

Return

DomainNickname — the requested nickname object

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.