2

Currently I am using google.picker.​ViewId.FOLDERS view in Google drive picker. This however, shows all the folders(including deep level folders) in my drive.

How to achieve a view in which only the top level folders are displayed at first? This would be similar to Dropbox chooser's file view.

Shyamal Parikh
  • 2,988
  • 4
  • 37
  • 78
  • 3
    you could use ".addView(new google.picker.DocsView().setParent('root').setIncludeFolders(true))". This will show the elements at root level, although it will show files as well. – Gerardo Nov 12 '15 at 01:28
  • This is exactly what I need. However, it seems that the search doesn't search in deep levels after applying this. Is there a way to overcome this issue? – Shyamal Parikh Nov 12 '15 at 10:08
  • 1
    your are right. try this one .addView(new google.picker.DocsView().setIncludeFolders(true).setOwnedByMe(true)). I was able to search files in deep levels – Gerardo Nov 12 '15 at 17:55
  • Thanks a lot! It works perfectly now. This solution should be the final answer to the question. – Shyamal Parikh Nov 13 '15 at 06:32

2 Answers2

8

For reference. This works fine now:

 let docsView = new google.picker.DocsView(google.picker.ViewId.FOLDERS)
                            .setParent('root')
                            .setSelectFolderEnabled(true);
Jelmer Jellema
  • 1,072
  • 10
  • 16
4

In order to see the folders and files at root level, you can use the view: addView(new google.picker.DocsView().setIncludeFolders(true).setOwnedByMe(true))

You will be able to search for items in deeper levels.

Gerardo
  • 3,460
  • 1
  • 16
  • 18
  • 2
    Per google documentation: "Do not combine with setOwnedByMe. When setIncludeFolders(true) is set, setOwnedByMe is ignored. – Abu Sulaiman Nov 26 '20 at 15:24