问题描述
我正在 GSuite/Workspace 通讯录中清理我的联系人,因为 Gmail 收件人: 桌面和移动应用程序的自动完成列表中没有显示联系人。我在文本应用中也遇到了类似的问题,找不到联系人。
事实证明,如果有多个联系人具有相同电子邮件地址,这将导致自动完成无法显示/查找联系人(三个联系人有两个联系人,只有一个电子邮件地址和另一个全名和电子邮件地址)。
Gmail 自动完成
我有 ~3200 个联系人,其中一些是
大部分重复的原因是 Gmail 中的 "Create contacts for auto-complete"
功能。需要将其设置为 "I'll add contacts myself"
以免导致重复。
我尝试了联系人中的“合并和修复”功能,但没有找到所有需要合并的联系人。因此,我正在创建一个 Google Apps 脚本来修复重复的联系人。
但是我遇到了大约 200 个联系人的问题,这些问题导致我的脚本失败。我尝试重新标记并删除联系人,但服务器失败并显示
Error We're sorry,a server error occurred. Please wait a bit and try again.
当我尝试访问 ID、姓名、电子邮件等时,我从服务器收到不同的错误。这是一个示例
Error: Could not locate target object while calling method getId on object with id 979
Error: Could not locate target object while calling method getFamilyName on object with id 1344
Error: Could not locate target object while calling method getEmails on object with id 3279
这是我的脚本,它只是遍历每个组的所有联系人:
function main() {
const allGroups = ContactsApp.getContactGroups()
let counter = 0
allGroups.forEach(group => {
const contacts = group.getContacts()
Logger.log('=====================\n' + group.getGroupName() + ' ' + contacts.length)
contacts.forEach((contact,index) => {
try {
// After trying to execute a method on a contact,an error is generated
// contact.getEmails()
// contact.getId()
contact.getFamilyName()
} catch(err) {
Logger.log(index + ' ' + err)
/*
deleteContact fails with
"We're sorry,a server error occurred. Please wait a bit and try again."
ContactsApp.deleteContact(contact)
*/
counter++
}
})
})
Logger.log('Total count: ' + counter)
}
联系方式调用
11:38:53 PM Info =====================
System Group: Family 0
11:38:53 PM Info =====================
System Group: Friends 0
11:38:56 PM Info =====================
System Group: My Contacts 3280
11:38:56 PM Info 233 Error: Could not locate target object while calling method getFamilyName on object with id 1344.
11:38:56 PM Info 234 Error: Could not locate target object while calling method getFamilyName on object with id 1345.
11:38:56 PM Info 243 Error: Could not locate target object while calling method getFamilyName on object with id 1346.
11:38:56 PM Info 244 Error: Could not locate target object while calling method getFamilyName on object with id 1347.
11:38:56 PM Info 304 Error: Could not locate target object while calling method getFamilyName on object with id 1348.
11:38:56 PM Info 308 Error: Could not locate target object while calling method getFamilyName on object with id 1349.
11:38:56 PM Info 311 Error: Could not locate target object while calling method getFamilyName on object with id 1350.
11:38:56 PM Info 313 Error: Could not locate target object while calling method getFamilyName on object with id 1351.
11:38:56 PM Info 316 Error: Could not locate target object while calling method getFamilyName on object with id 1352.
尝试删除联系人
11:48:15 PM Notice Execution started
11:48:15 PM Info =====================
~Error 0
11:48:16 PM Info =====================
~On Hold 502
11:48:17 PM Info =====================
Intake Form 781
11:48:17 PM Info =====================
Intake Form Received 211
11:48:18 PM Info =====================
Salesforce Sync 0
11:48:18 PM Info =====================
Starred in Android 12
11:48:18 PM Info =====================
System Group: Coworkers 0
11:48:18 PM Info =====================
System Group: Family 0
11:48:18 PM Info =====================
System Group: Friends 0
11:48:21 PM Info =====================
System Group: My Contacts 3280
11:48:21 PM Info 634 Error: Could not locate target object while calling method getFamilyName on object with id 1526.
11:48:21 PM Info Trying to delete user
11:48:21 PM Error
We're sorry,a server error occurred. Please wait a bit and try again.
调试脚本截图
我联系了 GSuite/Workspace 支持人员并被定向到这里。这似乎是通讯录中的一个错误,但我无法删除该联系人,也不知道我是如何获得这些无效联系人的。
- 有没有办法让我摆脱这些无效的联系人?怎么样?
- 有人了解这些无效联系人是如何生成的吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)