Page tree

Using AdminSDK Directory API in Apps Script

Class AdminDirectory used to Google's AdminSDK Directory API.

This service allows developer to use the API available on Google.

See this link for more information:
https://developers.google.com/admin-sdk/directory/v1/reference

!! Important !!

This Directory API will require admin rights from the GSuite team by default.

Some of these APIs (read only) allow to be used by public with the viewType set as "domain_public".

Here is an example code to get the UserPhotoURL from the Google API.

function getUserPhotoURL(userEmail) {

  // The optional argument needs to define the viewType to be domain_public. This will not require adminSDK permission.
  // See this link for reference - https://developers.google.com/admin-sdk/directory/v1/reference/users/get
  var userJson = AdminDirectory.Users.get(userEmail, {'viewType':'domain_public'});


  return user.thumbnailPhotoUrl;

}



The best way to get IT support is to use the new Service One Platform.