【发布时间】:2012-07-24 12:24:42
【问题描述】:
我无法弄清楚如何使用 Google Apps 脚本访问 Google 文档中的 cmets。查看 API 参考,我发现只有 CommentSection 类,但它被标记为已弃用。寻求帮助。谢谢。
桑杰
【问题讨论】:
标签: google-apps-script google-docs
我无法弄清楚如何使用 Google Apps 脚本访问 Google 文档中的 cmets。查看 API 参考,我发现只有 CommentSection 类,但它被标记为已弃用。寻求帮助。谢谢。
桑杰
【问题讨论】:
标签: google-apps-script google-docs
在这篇文章的初步讨论之后,我设法通过使用 v2 of Drive API 将 cmets 放入文档中。
这是我正在使用的代码:
function retrieveComments(fileId) {
var info = [];
//These arguments are optional
var callArguments = {'maxResults': 100, 'fields': 'items(commentId,content,context/value,fileId),nextPageToken'}
var docComments, pageToken;
do { //Get all the pages of comments in case the doc has more than 100
callArguments['pageToken'] = pageToken;
//This is where the magic happens!
docComments = Drive.Comments.list(fileId,callArguments);
//I've created a "getCommentsInfo" to organize the relevant info in an array
info = info.concat(getCommentsInfo(docComments.items));
pageToken = docComments.nextPageToken;
} while(pageToken);
return(info);
}
但是,由于 Drive API 是一项“高级服务”,您必须将其同时添加到:
【讨论】:
很遗憾,目前无法使用 Google Apps 脚本访问文档的 cmets。您可以在 issue tracker 上提出功能请求。
【讨论】: