Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Google Drive API filter trashed files

179 views
Skip to first unread message

Ivan Navarro

unread,
Jul 8, 2024, 2:15:35 PM7/8/24
to Chromium Extensions
hi,
I'm working on an extension that fetches Google Drive files from users, and I need to filter out the trashed files from the results. Based on the documentation, I believe I need the following approach to achieve this, but it isn't working, and trashed files are still being returned.

const query = `name = '${title}' and mimeType = 'application/vnd.google-apps.spreadsheet' and trashed = false`;
const searchUrl = `${url}?q=${encodeURIComponent(query)}`;


I've also read that I can check the trashed attribute in the returned files, but my results don't include this attribute.

Has anyone found an effective method to filter out trashed files?

Thanks for any help!

Iván


Stephen S.

unread,
Jul 9, 2024, 10:48:00 AM7/9/24
to Chromium Extensions, Ivan Navarro
Hi - Can you post a structure of what is returned? The `trashed` attribute should be returned. 

Also, possibly returning all fields `&fields=*` with the query or as a URL param may allow it to be included.

- Stephen

Tony Confrey

unread,
Jul 9, 2024, 11:35:03 AM7/9/24
to Chromium Extensions, Stephen S., Ivan Navarro

Ivan Navarro

unread,
Jul 9, 2024, 1:55:55 PM7/9/24
to Chromium Extensions, Tony Confrey, Stephen S., Ivan Navarro
Including the fields attribute resolved the issue effectively.
By default only id, kind, mimeType and name were returned.

Thank you!!

Iván
Reply all
Reply to author
Forward
0 new messages