Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Drive Picker: pick root folder

I need to allow user to select which Google Drive folder to upload their files.

I am using this code now:

view = new google.picker.DocsView(google.picker.ViewId.FOLDERS).
  setParent('root').
  setSelectFolderEnabled(true)

picker = new google.picker.PickerBuilder().
  addView(view).
  setSelectableMimeTypes('application/vnd.google-apps.folder').
  enableFeature(google.picker.Feature.NAV_HIDDEN).
  setOAuthToken(token).
  setDeveloperKey(key).
  setAppId(appid).
  setCallback(picker_callback).
  build()

But there are a few problems here:

  1. User still see files despite that google.picker.ViewId.FOLDERS is used
  2. There is no way to select root folder

Is any way to fix my problems?

Currently files are always upload to root folder, I don't want this new feature remove this possibility.

like image 227
Bryan Chen Avatar asked Aug 11 '15 05:08

Bryan Chen


People also ask

How do I access my Google Drive root folder?

Go to organization → Settings → Integrations → Google Drive. Click Configure and Select the root folder. Click Select folder (root) and choose a root folder that will be visible to everyone. Other folders from Google drive will not be visible to organization users.

What is root folder in Google Drive?

Each user has a "root" folder called "My Drive" that functions as their primary hierarchy, and consists of everything that descends from this root folder. The user is the primary owner of this folder. Shared drives. A shared drive is an organizational structure within Google Drive that lives parallel to My Drive.

Can you share the root of Google Drive?

Share the Entire Google Drive with Share Option. In order to share entire Google Drive to another Google Drive, there is one Share option available in Google Drive. You need to choose all files and folders from Google Drive and then choose Share option for each folder to complete the process successfully.


1 Answers

Unfortunately this only answers the first question/problem.

You can specify the mime-type for the view, as well as for the picker:

var view = new google.picker.DocsView(google.picker.ViewId.FOLDERS);
view.setMimeTypes('application/vnd.google-apps.folder');
view.setSelectFolderEnabled(true);

As far as I know there's no way to select the root, so you have to get your user to make a UI choice beforehand.

like image 198
HeyHeyJC Avatar answered Oct 16 '22 23:10

HeyHeyJC