0

I'm a bit stuck with the Google API and the Drive file picker.

I want the Drive file picker to open at a given location (folder) in Drive, but users should also be able to navigate outside that location anywhere else to select a file from any other location.

Using setParent() on the DocsView object, the picker does open with that "starting" folder. However, the navigation pane also disappears and it's not possible to get anywhere in the Drive (unless doing a search, but that's not obvious...).

For example when there is NO setParent() this what I got, after going inside the "starting" folder --> there is a navigation pane under the search area: enter image description here

But if I set a parent (using setParent()), then I have no more navigation pane, and I need it... enter image description here

This is how I create the builder:

const docsView = new google.picker.DocsView();
docsView.setMimeTypes("application/vnd.google-apps.folder" + ((this.showFolderOnly) ? "" : ",application/aspyre"));
if(this.appStore.initFolder != undefined){
    docsView.setParent(this.appStore.initFolder.toString());
}
const picker = new google.picker.PickerBuilder()
    .addView(docsView)
    .disableFeature(google.picker.Feature.MULTISELECT_ENABLED)
    .disableFeature(google.picker.Feature.NAV_HIDDEN)
    .setLocale(useStore().appLang)
    .setOAuthToken(this.oauthToken)
    .setDeveloperKey(this.devKey)
    .setCallback(this.pickerCallback)
    .build();
picker.setVisible(true);

Thanks a lot for your help, maybe I've missed something out the document but frankly... I don't know what...

Pierre

Pierre
  • 59
  • 1
  • 6
  • It seems that it is not possible to do this with the Google Picker API, you can submit a feature idea through [here](https://issuetracker.google.com/issues/new?component=191650&template=824106), this [thread](https://stackoverflow.com/questions/55967332/google-picker-search-only-inside-parent-folder) is related to your question and the only workaround was creating their own interface and used the Drive API instead. – Lorena Gomez May 24 '23 at 21:32
  • Hello, thanks for your answer and the links. For the moment, I've just made 2 docviews in the picker so that users can easily get to their drive. It's not the best but it works. I think that was what was done in that other [thread](https://stackoverflow.com/questions/71391991/is-it-possible-to-upload-to-root-of-sub-folders-with-google-picker) which at first I didn't understand. – Pierre May 25 '23 at 09:13

0 Answers0