![](/img/trans.png)
[英]I have a shared google drive folder . Is there any methods to list all the files in my google sheets?
[英]with google files list how can I only show my owned folder instead of shared ones?
我只想在使用以下代碼時顯示我擁有的文件,但實際上它列出了所有文件,甚至那些與我共享的文件。 請問我該如何防止這種情況發生
gapi.client.drive.files
.list({
includeItemsFromAllDrives: false,
supportsAllDrives: false,
pageSize: 10,
fields: 'nextPageToken, files(id, name, mimeType, modifiedTime)',
q: searchTerm
})
您應該使用的搜索詞是所有者。 特別是用戶的 email 地址,您作為所有者的身份如何
'XXX@gmail.com' in owners
或者,如果您正在尋找當前經過身份驗證的用戶,請使用
'me' in owners
要查找文件夾,您將使用以下內容,它基本上檢查文件夾的 mime 類型。
mimeType = 'application/vnd.google-apps.folder'
然后將它們串在一起,您只需使用和
例子
gapi.client.drive.files
.list({
includeItemsFromAllDrives: false,
supportsAllDrives: false,
pageSize: 10,
fields: 'nextPageToken, files(id, name, mimeType, modifiedTime)',
q: ''me' in owners and mimeType = 'application/vnd.google-apps.folder''
})
你需要修復我周圍的''我對 javascript 不太有經驗對不起。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.