Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Directory API Google Apps Script retrieve groups with prefix?

Apparently the query parameter is being rejected from the following code, attempting to retrieve groups matching a given prefix:

  var OUPageToken;
  var groupList = AdminDirectory.Groups.list({
    customer:"my_customer", 
    domain: "mydomain.com",
    maxResults: 500,
    pageToken: OUPageToken,
    query: "'email=students*'"
    })["groups"];

Throws:

Error   
GoogleJsonResponseException: API call to directory.groups.list failed with error: Invalid Input: query

Could it be that the SDK version https://developers.google.com/admin-sdk/directory/reference/rest/v1/groups/list differs from the apps-script version https://developers.google.com/apps-script/advanced/admin-sdk-directory#list_all_groups ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Your query probably isn’t formatted correctly. See guide.

Try the following:

  var groupList = AdminDirectory.Groups.list({
    customer:"my_customer", 
    domain: "mydomain.com",
    maxResults: 500,
    pageToken: OUPageToken,
    query: "email:students*"
    })["groups"];
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading