I am trying to use google api with google scripts. I can get data from google apps for example by: var result = AdminDirectory.Groups.get(OptionalArgs); but when i try to do the same with: var result = AdminDirectory.Groups.aliases.list(OptionalArgs); I receive TypeError: Cannot call method "list" of undefined How can I get and update list of google apps groups aliases using google scripts? What am I doing wrong with this sample?
2 Answers
The alias property should be capitalised.
var result = AdminDirectory.Groups.Aliases.list(OptionalArgs);

- 1,785
- 1
- 12
- 23
Not knowing what you already have done and what hasn't been done, I suggest that you please check and ensure that you enable advance services before use and as described in the API's prerequisites documentation, the Admin SDK must also be enabled on your domain.
And, to retrieve all group aliases,
use the following
GET
request and include the authorization described in Authorize requests. ThegroupKey
can be the group's primary email address, the group's unique id, or any of the group aliases' emails. For the request and response properties, see the API Reference:
GET https://www.googleapis.com/admin/directory/v1/groups/groupKey/aliases
Lastly, as also noted, these are editable group aliases in the account's primary domain or subdomains. For group aliases outside of the account, see the group's nonEditableAliases property.
Reading through Google Apps Script Quickstart might also help.