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:
google.picker.ViewId.FOLDERS
is usedIs any way to fix my problems?
Currently files are always upload to root folder, I don't want this new feature remove this possibility.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With