Drive.Files.get(fileid).LastModifiyingUser.emailaddress 使用 Google Apps 脚本无法在共享驱动器中找到文件
Drive.Files.get(fileid).LastModifiyingUser.emailaddress can't find the file in the shared drive using Google Apps Script
对于记录所有电子表格文件并在公式中引用另一个电子表格的脚本,我想检索文件的最后修改用户。
此应用程序脚本仅在我拥有的域内使用;电子表格文档既存在于 MyDrive 中,也存在于我们的共享驱动器中。
我正在使用以下语句:
var docModifierEmail = Drive.Files.get(docId).lastModifyingUser.emailAddress
很难找到文档
我一直遇到的错误是:
API call to drive.files.get failed with error: File not found: 1Nz0_Kme172EQXAwgW55d7H.....
我使用的范围:
> "oauthScopes": [
> "https://www.googleapis.com/auth/spreadsheets",
> "https://www.googleapis.com/auth/userinfo.email",
> "https://www.googleapis.com/auth/drive",
> "https://www.googleapis.com/auth/drive.activity" <--- not sure if this is needed
我的问题:
- 我使用的函数调用正确吗?
- 我使用的范围是否正确?
- 检索最后修改用户的正确语句应该是什么
ID 为
docId
? 的文件的电子邮件地址
Drive API version 2 available in Apps Script needs at least one of the following scopes for Files.get():
范围:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/drive.metadata.readonly
https://www.googleapis.com/auth/drive.appdata
https://www.googleapis.com/auth/drive.metadata
https://www.googleapis.com/auth/drive.photos.readonly
尝试从您的共享 drive/team 驱动器访问文件时,您需要将可选查询参数 supportsAllDrives
设置为 true
Drive.Files.get("file id",{supportsAllDrives:true}).lastModifyingUser.emailAddress;
附加参考:
对于记录所有电子表格文件并在公式中引用另一个电子表格的脚本,我想检索文件的最后修改用户。 此应用程序脚本仅在我拥有的域内使用;电子表格文档既存在于 MyDrive 中,也存在于我们的共享驱动器中。
我正在使用以下语句:
var docModifierEmail = Drive.Files.get(docId).lastModifyingUser.emailAddress
很难找到文档 我一直遇到的错误是:
API call to drive.files.get failed with error: File not found: 1Nz0_Kme172EQXAwgW55d7H.....
我使用的范围:
> "oauthScopes": [
> "https://www.googleapis.com/auth/spreadsheets",
> "https://www.googleapis.com/auth/userinfo.email",
> "https://www.googleapis.com/auth/drive",
> "https://www.googleapis.com/auth/drive.activity" <--- not sure if this is needed
我的问题:
- 我使用的函数调用正确吗?
- 我使用的范围是否正确?
- 检索最后修改用户的正确语句应该是什么
ID 为
docId
? 的文件的电子邮件地址
Drive API version 2 available in Apps Script needs at least one of the following scopes for Files.get():
范围:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/drive.metadata.readonly
https://www.googleapis.com/auth/drive.appdata
https://www.googleapis.com/auth/drive.metadata
https://www.googleapis.com/auth/drive.photos.readonly
尝试从您的共享 drive/team 驱动器访问文件时,您需要将可选查询参数 supportsAllDrives
设置为 true
Drive.Files.get("file id",{supportsAllDrives:true}).lastModifyingUser.emailAddress;
附加参考: