Created
December 20, 2013 02:57
-
-
Save suntong/8049824 to your computer and use it in GitHub Desktop.
Google Picker for Google Docs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/20599404/google-picker-for-google-drive | |
function doGet() { | |
var app = UiApp.createApplication(); | |
var selectCkH = app.createServerHandler('selectFile'); | |
var closeHandler = app.createServerHandler('closeDocsPicker'); | |
var docsDialog = app.createDocsListDialog().showDocsPicker()//.setInitialView(google.picker.ViewId.FOLDERS) | |
// .addView(new google.picker.PhotosView() | |
// .setType(google.picker.PhotosView.Type.FEATURED)) | |
.addCloseHandler(closeHandler) | |
.addSelectionHandler(selectCkH); | |
docsDialog.setDialogTitle('Select a Doc From Drive:'); | |
return app; | |
} | |
function closeDocsPicker() { | |
var app = UiApp.getActiveApplication(); | |
// close operations | |
return app; | |
} | |
function selectFile (e) { | |
var app = UiApp.getActiveApplication(); | |
var fileId = e.parameter.items[0]['id']; | |
app.add(app.createLabel('File Id of Selected Doc: '+fileId)); | |
return app; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment