Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script .getEmail()方法用于DriveApp和SpreadsheetApp for Google脚本_Google Apps Script - Fatal编程技术网

Google apps script .getEmail()方法用于DriveApp和SpreadsheetApp for Google脚本

Google apps script .getEmail()方法用于DriveApp和SpreadsheetApp for Google脚本,google-apps-script,Google Apps Script,我是谷歌应用程序脚本的新手,正在尝试获得一组可以编辑谷歌电子表格的用户。当我执行DriveApp.getFileById('xxxxxx').getEditors()…时,它返回一个用户数组。当我对数组中的每个项运行.getName()方法时,它会返回名称。但是,当对每个项目运行.getEmail()方法时,它不会返回每个用户的电子邮件地址 我尝试使用SpreadsheetApp.openFileById('xxxxxx').getEditors()…打开电子表格,通过这个数组,我能够对每个项目

我是谷歌应用程序脚本的新手,正在尝试获得一组可以编辑谷歌电子表格的用户。当我执行
DriveApp.getFileById('xxxxxx').getEditors()
…时,它返回一个用户数组。当我对数组中的每个项运行
.getName()
方法时,它会返回名称。但是,当对每个项目运行
.getEmail()
方法时,它不会返回每个用户的电子邮件地址

我尝试使用
SpreadsheetApp.openFileById('xxxxxx').getEditors()
…打开电子表格,通过这个数组,我能够对每个项目运行
.getEmail()
方法并获取电子邮件地址


这些
.getEmail()
方法之间有什么区别?为什么我似乎可以从电子表格应用程序而不是DriveApp获得电子邮件?

DriveApp以及DriveAPI保护合作者的电子邮件。你再也找不到了。 您必须使用旧的API,这些API最终将被弃用。
在新的api中,您只能告诉用户您以前是否与他们共享了某些内容并保存了他们的许可证ID。有关更多信息,请参阅驱动器api文档。

很有意义。非常感谢。