San*_*jay 2 google-docs google-apps-script
我无法弄清楚如何使用Google Apps脚本访问Google文档中的注释。查看API参考,我仅找到CommentSection类,但已将其标记为已弃用。寻求帮助。谢谢。
桑杰
经过本文的初步讨论,我已经成功使用Drive API v2在文档中获取注释。
这是我正在使用的代码:
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);
}
Run Code Online (Sandbox Code Playgroud)
但是,由于Drive API是“高级服务”,因此必须将它们都添加到:
| 归档时间: |
|
| 查看次数: |
277 次 |
| 最近记录: |