Search code examples
javascriptgoogle-drive-apigoogle-picker

How does it display designate folder in Google Picker for Google Drive file?


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!


Solution

  • 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).