0
votes

When i am using Google drive API query for documents its returning 0 items even though documents in between that range are present. I am facing this issue with time range only. I have written query below. Can anyone help me out with this..

mimeType!='application/vnd.google-apps.folder' AND trashed=false AND 'me' in owners AND modifiedTime>='2018-11-16T14:00:00' AND modifiedTime<='2018-11-16T15:59:59'

1
Did my answer show you the result what you want? Would you please tell me about it? That is also useful for me to study. If this works, other people who have the same issue with you can also base your question as a question which can be solved. If you have issues for my answer yet, feel free to tell me. I would like to study to solve your issues.Tanaike

1 Answers

0
votes

In your query, I think that mimeType!='application/vnd.google-apps.folder' AND trashed=false AND 'me' in owners is correct. But about modifiedTime>='2018-11-16T14:00:00' AND modifiedTime<='2018-11-11T5:59:59', in this case, the files "after 2018-11-16T14:00:00" AND "before 2018-11-11T5:59:59" are trying to be retrieved. So the result becomes {"files": []}.

Pattern 1:

For modifiedTime, if you want to retrieve files from 2018-11-11T5:59:59 to 2018-11-16T14:00:00, how about this query?

mimeType!='application/vnd.google-apps.folder' AND trashed=false AND 'me' in owners AND modifiedTime<='2018-11-16T14:00:00' AND modifiedTime>='2018-11-11T5:59:59'

Pattern 2:

For modifiedTime, if you want to retrieve files of "before 2018-11-11T5:59:59" and "after 2018-11-16T14:00:00", how about this query?

mimeType!='application/vnd.google-apps.folder' AND trashed=false AND 'me' in owners AND (modifiedTime>='2018-11-16T14:00:00' OR modifiedTime<='2018-11-11T5:59:59')

Note:

  • In your query, 2018-11-115:59:59 of modifiedTime<='2018-11-115:59:59 is wrong. But if 2018-11-115:59:59 is used, the query error occurs. So I supposes that you are using the correct value in your actual script.

Reference:

If I misunderstand your question, I'm sorry.