このAPIを使ってみませんか?
developers.google.com/google-apps/documents-list
改訂履歴フィードにアクセスできるようです。
ただし、例は.NETにあります。このAPIをGoogleAppsScriptで適用/使用するにはどうすればよいですか?誰もがその方法を知っていて、光を当てることができますか?たぶん短いサンプルコード?
ありがとう。
このAPIを使ってみませんか?
developers.google.com/google-apps/documents-list
改訂履歴フィードにアクセスできるようです。
ただし、例は.NETにあります。このAPIをGoogleAppsScriptで適用/使用するにはどうすればよいですか?誰もがその方法を知っていて、光を当てることができますか?たぶん短いサンプルコード?
ありがとう。
DocLists API のプロトコルを確認する必要があります。このプロトコルは、URLFetch および Google oAuth と一緒に使用できます。次の簡単な例では、リビジョン履歴を json 形式で返します。
//Get revison history
//resource_id is the id of the doc
function getRevisionHistory(resource_id){
var scope = 'https://docs.google.com/feeds/';
var fetchArgs = googleOAuth_('docs', scope);
fetchArgs.method = 'GET';
var url = scope + 'default/private/full/'+resource_id+'/revisions?v=3&alt=json';
var urlFetch = UrlFetchApp.fetch(url, fetchArgs);
var jsonFeed = Utilities.jsonParse(urlFetch.getContentText()).feed.entry;
return jsonFeed
}
//Google oAuth
//Used by getRevisionHistory
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"};
}
DocsList API でもっと遊ぶには、私の Google サイト https://sites.google.com/site/appsscripttutorial/urlfetch-and-oauthでいくつかの例を見ることができます。
チェックアウト: https://sites.google.com/site/scriptsexamples/custom-methods/driveservice ソースをファイルにコピーするだけです。
今後数週間で不足しているメソッドを追加します。リビジョンは確かに私のリストにあります。
次のようなライブラリを使用できます: DOCS_LIST_API.GdocToFormat (docID, format)
OAuth をセットアップする必要はありません。組み込まれています。