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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.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 如何获取Google Drive API中修订版的导出链接_Google Apps Script_Google Drive Api - Fatal编程技术网

Google apps script 如何获取Google Drive API中修订版的导出链接

Google apps script 如何获取Google Drive API中修订版的导出链接,google-apps-script,google-drive-api,Google Apps Script,Google Drive Api,我正在使用谷歌应用程序脚本尝试获取谷歌绘图各种版本的导出链接列表。下面的代码再现了这个问题。要进行尝试,请使用图形ID调用getRevisionHx //Google oAuth function googleOAuth_(name,scope) { var oAuthConfig = UrlFetchApp.addOAuthService(name); oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAu

我正在使用谷歌应用程序脚本尝试获取谷歌绘图各种版本的导出链接列表。下面的代码再现了这个问题。要进行尝试,请使用图形ID调用getRevisionHx

//Google oAuth
function googleOAuth_(name,scope) {
  var oAuthConfig = UrlFetchApp.addOAuthService(name);
  oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope="+scope);
      oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
  oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
  oAuthConfig.setConsumerKey("anonymous");
  oAuthConfig.setConsumerSecret("anonymous");
  return {oAuthServiceName:name, oAuthUseToken:"always"};
}

function getRevisionHx(resource_id){
  var scope = 'https://www.googleapis.com/auth/drive';
  var myKey = KEY_DELETED_FROM_SAMPLE_CODE;

  var fetchArgs = googleOAuth_('drive', scope);
  fetchArgs.method = 'GET';

  var url = "https://www.googleapis.com/drive/v2/files/" + resource_id + "/revisions?key=" + myKey;
  var urlFetch = UrlFetchApp.fetch(url, fetchArgs);

... //snip

}
在snip中,urlFetch成功了,它有一个修订列表,每个修订都有exportLinks。如果我获取其中一个ExportLink并使用web浏览器下载,它总是检索文档的最新版本,而不是指定的修订版。这是一个错误还是我做错了什么


换句话说,上面的所有代码似乎都工作正常(API调用成功并返回预期结果),但返回的exportLink URL并没有指向他们所说的将要进行的修订。

同样的结果已经重现


我会给你报告的。很抱歉给您带来不便。

一年多后,此功能仍处于中断状态。在所有导出链接中,修订id似乎都被忽略。有更新吗,@jungyoungwak?很抱歉我不再为谷歌工作了。我不能为这个问题提供支持。