0

I use the Google Picker API, and below is my code:

var picker = new google.picker.PickerBuilder().
            addView(new google.picker.DocsView()).
            setOAuthToken(oauthToken).
            setDeveloperKey(developerKey).
            setCallback(pickerCallback).
            build();
            picker.setVisible(true);

I want it to display designate folder initially and only shows the files and folders beneath it, how should I modify? Thanks!

Jack
  • 347
  • 1
  • 2
  • 22
  • 2
    You may check the [DocsView.setParent(string)](https://developers.google.com/picker/docs/reference#DocsView) method which sets the initial parent folder to display. Here's a sample [tutorial](https://ctrlq.org/code/20393-google-file-picker-example) which might help. Also, as stated on this [SO post](https://stackoverflow.com/questions/21173883/select-folder-with-google-picker), note that you have to set oAuth token on picker for all the views by using `setOAuthToken(oauthToken)` and `setDeveloperKey(developerKey)`. – abielita Jun 08 '17 at 17:19
  • Thank @abielita, that works! – Jack Jun 09 '17 at 08:51

1 Answers1

2

You may check the DocsView.setParent(string) method which sets the initial parent folder to display. Here's a sample tutorial which might help. Also, as stated on this SO post, note that you have to set oAuth token on picker for all the views by using setOAuthToken(oauthToken) and setDeveloperKey(developerKey).

abielita
  • 13,147
  • 2
  • 17
  • 59