該函數將返回與您共享的所有文件的數組。它使用Advanced Drive Service,它必須是enabled before use。
/**
* Get array of files on user's Google Drive that have been shared with them.
* From https://stackoverflow.com/a/15947340/1677912
*
* @returns {Array} Array of file resources
* (see https://developers.google.com/drive/v2/reference/files#resource)
*/
function getSharedWithMe() {
var optionalArgs = {q:"sharedWithMe=true"};
var sharedFiles = Drive.Files.list(optionalArgs);
debugger; // pause in debugger
return sharedFiles.items;
}
你可以做同樣的事情,沒有代碼,通過使用谷歌驅動器SDK「資源管理器」。
請參閱this previous answer使用此技術獲取已刪除文件的列表。
您會在Google Drive SDK文檔頁面的底部找到文件列表的Files List API Explorer。有關搜索條件的信息,請參閱Search for files。對於我們的目的,我們只會使用sharedWithMe
。
如果你把「田」的空白,你會得到上已知的對共享文件的一切。您可以使用難看的減號標記展開和摺疊結果。但限制輸出是有幫助的。我用items(id,selfLink,owners/displayName)
。下面是如何看起來:
謝謝,原來我需要查詢的話(業主MYEMAILADDRESS')在通話,但由此產生的JSON正是我需要在我的appscript做我想做什麼。 – jankeir 2013-04-11 12:52:24