0

I'm trying to create script to download all files from another user shared folder in google drive using rest api. If i'm right, there are two variants:

  1. Using drive.children.list, with folder ID
  2. Using drive.files.list, with search query like 'FOLDER_ID in parents'

But both of this variants returning only files which were once opened by my google account in browser. If I open file in browser - this file will appear in results of API calls.

Folder is shared for anyone, who has link.

Where is the problem, how I can list all files in folder?

2 Answers2

0

Since you did not give us any info about the SCOPE, I am wild-guessing that it may be your problem. You probably have FILE scope, instead of DRIVE.

Also, I would recommend to test these things with 'TryIt!' here. You can quickly modify both scopes and queries there.

Good Luck

seanpj
  • 6,735
  • 2
  • 33
  • 54
  • Thank you for answer, it helped me to discover problem - i used incorrect scope variable from old script. Trivial bugs are most difficult to discover =( – Dmitry Yaroslavsky Aug 07 '15 at 13:29
0

This is a bug/quirk in the Drive API, though there is an easy workaround. If you call files.update with 'addParents=root' it'll add the shared folder under 'My Drive'. This has the effect of making the files part of your corpus and they'll appear in results.

Steve Bazyl
  • 11,002
  • 3
  • 21
  • 24