More Power to Google Apps Domain Administrators with Apps Script

Friday, June 15, 2012 | 10:10 AM

Labels:

At the end of last year we launched the UserManager Apps Script service, allowing Google Apps domain administrators to write scripts to programmatically create, delete and edit their user accounts.

We are now extending the family of Domain services with two new additions: NicknameManager and GroupsManager.

The NicknameManager service allows domain administrators to define alternate email addresses (i.e. “nicknames”) with a single line of code, as in the following example:

var nickname = NicknameManager.createNickname("user", "nick");

With the GroupsManager service, Google Apps domain administrators can create and delete groups, and manage their members and owners. The following example shows how to list all members of a group given its unique groupId:

function listMembers(groupId) {
    var members = GroupsManager.getGroup(groupId).getAllMembers();
    for (var i in members) {
        var member = members[i];
        Logger.log(i + ": " + member);
    }
}

With the same service, one line of code is enough to add a member to a group:

GroupsManager.getGroup(groupId).addMember(memberId);

If you want to know more about the new NicknameManager and GroupsManager services, please check our documentation, and don’t hesitate to get in touch with us if you have questions or suggestions.


Claudio Cherubino   profile | twitter | blog

Claudio is an engineer in the Google Drive Developer Relations team. Prior to Google, he worked as software developer, technology evangelist, community manager, consultant, technical translator and has contributed to many open-source projects. His current interests include Google APIs, new technologies and coffee.

0 comments: