0

I am making a gmail addon in which i am trying to get the user's contact groups (labels) using the code:

var groups = ContactsApp.getContactGroups();

I already have added required scope : https://www.google.com/m8/feeds in manifest file (appsscript.json) but it returns "Exception: Unexpected error while getting the method or property getContactGroups on object ContactsApp". This method was working fine when it was a default apps script project. I started getting this expection after linking my apps script project with Google cloud project. I am also using People API in my project. When I add https://www.google.com/m8/feeds in scopes on consent screen of Google cloud platform it does not show up there. Instead, https://www.googleapis.com/auth/contacts is shown in the scopes list. It might be because I am using People api and both of these scopes are for read/write user's contacts. And My consent screen on Google cloud platform is still under verification.

Also,I am not able to use any of the methods provived by ContactsApp class. I am getting the same exception when I used var contact = ContactsApp.getContact("abc@gmail.com");

Any help would be appreciated.

Thanks

1 Answers1

0

When changing from a default Apps Script project to a GCP project, you need to enable the necessary APIs in your GCP console

  • In your particular case you need to enable the Contacts API in your GCP console - for the chosen project
  • Depending on the rest of your code, you might need to enable also other APIs (e.g. Gmail)
  • Follow those instructions to enable the requested APIs
ziganotschka
  • 25,866
  • 2
  • 16
  • 33