You do not have permission to call getContacts

被刻印的时光 ゝ 提交于 2019-12-24 16:44:26

问题


I'm developing the GMail Add-on that pulls out all user's contacts to card:

var contacts = ContactsApp.getContacts();

I already enabled ContactsAPI in Google API Console and added scope: https://www.googleapis.com/auth/contacts.readonly

But the error is still there and the Contacts API is missing in the project's Advanced Google Service pop-up.


回答1:


Through trial and error, and this hard-to-find list I managed to get ContactsApp.getContacts() to work. You need to add this scope:

"oauthScopes": [
  "https://www.google.com/m8/feeds",



回答2:


There is no need to enable Contacts API and set the scope when using the ContactsApp. When using this, upon reviewing the permission to be used, your app will automatically select the necessary permission for ContactsApp to work properly.

I've use the same code as yours:

function myFunction() {
  // The code below will retrieve all the user's contacts
 var contacts = ContactsApp.getContacts();

  Logger.log(contacts)
}

Here is the result I received:

Kindly check and review your code, you might have missed something.

Hope this helps.



来源:https://stackoverflow.com/questions/47202503/you-do-not-have-permission-to-call-getcontacts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!