I only want to show my owned files when use the following code, but actually it list all the files even those share with me. how can I prevent this happen please
gapi.client.drive.files
.list({
includeItemsFromAllDrives: false,
supportsAllDrives: false,
pageSize: 10,
fields: 'nextPageToken, files(id, name, mimeType, modifiedTime)',
q: searchTerm
})
The search term you should be using is owners. specifically the email address of the user how you are after as owner
'XXX@gmail.com' in owners
Or if you are looking for the currently authenticated user then use
'me' in owners
To find folders you would use the following which basically checks for the mime type of a folder.
mimeType = 'application/vnd.google-apps.folder'
Then to string them both together you just use and
Example
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''
})
You need to fix the '' around the me im not very experienced with javascript sorry.