【问题标题】:Issue deleting Google Shared Contact删除 Google 共享联系人的问题
【发布时间】:2016-04-09 13:08:23
【问题描述】:

我已经能够通过 API 成功添加联系人,但我无法删除我创建的联系人。

https://sites.google.com/site/scriptsexamples/new-connectors-to-google-services/shared-contacts

function deletecontact()
{
  SharedContactsApp.setOAuth2AccessToken(getSharedContactsService().getAccessToken    ());
  var contacts = SharedContactsApp.getContactById('5c8b05ab8c9f68c6');
  SharedContactsApp.deleteContact('5c8b05ab8c9f68c6');
 }

我收到以下错误消息:

TypeError: Cannot call method "getElements" of undefined. (line 200, file "Code", project "SharedContactsApp")

如何消除这个错误?

另外...

我尝试使用以下代码设置职位,但收到以下错误:

ReferenceError:"profile" 未定义。 (第 142 行,文件“代码”)

function changeJobTitle2() 
{
   SharedContactsApp.setOAuth2AccessToken(getSharedContactsService().getAccessToken    ());
  var contact = SharedContactsApp.getContactById('82f05968956d66f');
  profile.setJobTitle('Google Apps Expert');
}

【问题讨论】:

  • 我运行了 Peter Herrmann 在另一篇文章中提到的 tinyTest,结果恢复正常。
  • function hailmary() { SharedContactsApp.setOAuth2AccessToken(getSharedContactsService().getAccessToken()); var contact = SharedContactsApp.getContactById('82f05968956d66f'); SharedContactsApp.deleteContact(contact) }

标签: google-api google-apps google-shared-contacts


【解决方案1】:

我想通了。

function hailmary() 
{
  SharedContactsApp.setOAuth2AccessToken(getSharedContactsService().getAccessToken());
  var contact = SharedContactsApp.getContactById('82f05968956d66f');
  SharedContactsApp.deleteContact(contact)
}

【讨论】:

    猜你喜欢
    • 2021-11-30
    • 2012-07-07
    • 1970-01-01
    • 1970-01-01
    • 2018-02-22
    • 2018-05-25
    • 2015-10-09
    • 2012-10-02
    • 1970-01-01
    相关资源
    最近更新 更多