I'm using google the plugin Picker for Google Drive. My idea is select only the folders and get its ID.
Currently not let me select them,now only enter into that directory. I am using this code:
function MenuCtrl($scope, $location, appId) {
var onFilePicked = function (data) {
$scope.$apply(function () {
if (data.action == 'picked') {
var id = data.docs[0].id;
$location.path('/edit/' + id);
}
});
};
$scope.open = function () {
var view = new google.picker.View(google.picker.ViewId.FOLDERS);
view.setMimeTypes('application/vnd.google-apps.folder');
var picker = new google.picker.PickerBuilder()
.setAppId(appId)
.addView(view)
.setCallback(angular.bind(this, onFilePicked))
.build();
picker.setVisible(true);
};
$scope.create = function () {
this.editor.create();
};
$scope.save = function () {
this.editor.save(true);
}
}
How could I get selected folder without going inside it?
Thank you very much in advance and greetings.
The Google File Picker API lets users easily upload files to Google Drive and also select existing files and folders from Drive. The File Upload Forms for Google Drive is written in Google Apps Script and it lets users upload files to the form owner’s folder through the File Picker API.
If your app needs to let a user pick a file from his Google Drive, you might consider using the Google Picker API.
Access files and folders by letting the user interact with a picker. You can use the FileOpenPicker and FileSavePicker classes to access files, and the FolderPicker to access a folder. For a complete sample, see the File picker sample.
An email app might display a file picker for the user to pick attachments. With a picker your app can access, browse, and save files and folders on the user's system. Your app receives those picks as StorageFile and StorageFolder objects, which you can then operate on.
I solved the problem, this is the new Code:
$scope.open = function () {
var docsView = new google.picker.DocsView()
.setIncludeFolders(true)
.setMimeTypes('application/vnd.google-apps.folder')
.setSelectFolderEnabled(true);
var picker = new google.picker.PickerBuilder()
.addView(docsView)
.setCallback(callback)
.build();
picker.setVisible(true);
});
Thanks for the help and greetings!
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