【问题标题】:Google apps script drive file: How to get user who last modified file?谷歌应用脚​​本驱动文件:如何获取最后修改文件的用户?
【发布时间】:2015-01-19 03:44:11
【问题描述】:

要获取文件的最后更新日期,您可以致电 getLastUpdated()

我如何获取在 Google Apps 脚本代码中进行此上次更新的用户

我已经尝试在Advanced Drive ServiceAdvanced Drive Service列出修订下运行代码

var revisions = Drive.Revisions.list(fileId);

但我明白了

ReferenceError: "Drive" is not defined.

【问题讨论】:

    标签: google-apps-script


    【解决方案1】:

    https://developers.google.com/apps-script/guides/services/advanced

    在资源 > 高级 Google 服务中,打开 Drive API...

    在同一个窗口中 > 点击 Google Developer's Console >> 启用 Drive API 和 Drive SDK...

    那么……

    Drive.Files.get('<FILEDID>').lastModifyingUser
    

    【讨论】:

    • 这似乎对我不起作用.. TypeError: Cannot call property lastModifyingUser in object
    • @dsme 开始一个新帖子,然后使用您使用的代码和步骤
    • 您可能需要启用Google Cloud Platform API Dashboard中的服务
    【解决方案2】:

    说清楚:

    首先将驱动 API 和 SDK 启用为described by Bryan P。然后就可以使用了

    var lastemailuser =  Drive.Files.get(<FILEDID>).lastModifyingUser.emailAddress;
    
    var lastnameuser =  Drive.Files.get(<FILEDID>).lastModifyingUserName;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多