0

Google Picker is cool in that it provides users a more modern experience:

  1. Familiar — The look-and-feel users will recognize from Google Drive and other Google properties.
  2. Graphical — A dialog experience, with many views showing previews or thumbnails.
  3. Streamlined — An inline, modal window, so users never leave the main application.

https://developers.google.com/picker/docs/?csw=1

However, it seems to aims for html service, and even need you to register your project before using it.

Is it possible to just use it as a personal GDoc Picker for my Google Drive? A simple working demo is very much appreciated.

EDIT: Thank you Trevor for your wonderful script. It works nice and charm for picking Google Docs under Google Drive.

To make the story full, could you also give an example to use the Google Picker as the folder Picker as well please?

Basically, I need to turn on:

  • DocsView.setIncludeFolders(true)
  • DocsView.setSelectFolderEnabled(true)
  • setInitialView(google.picker.​ViewId.FOLDERS)
Kara
  • 6,115
  • 16
  • 50
  • 57
xpt
  • 20,363
  • 37
  • 127
  • 216

1 Answers1

1

This might be what you are looking for:

function doGet() {
  var app = UiApp.createApplication();  
  var selectCkH = app.createServerHandler('selectFile');  
  var closeHandler = app.createServerHandler('closeDocsPicker');
  var docsDialog = app.createDocsListDialog().showDocsPicker() 
      .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;
}
Trevor Iampen
  • 217
  • 2
  • 13
  • Thanks Trevor. You are talking in a complete different language than what I saw in https://developers.google.com/picker/docs/?csw=1. I tried but failed to find where the APIs are from. I've also checked https://developers.google.com/picker/docs/reference as well. Please share. The reason that I'm asking is that I try to adapt the code into folder picker myself, but failed. I'll update the OP to reflect the new request. Thanks. – xpt Dec 20 '13 at 02:09
  • 1
    Currently in UiApp you can set the DocsDialog to "see" folders in an initial folder view with: app.createDocsListDialog().showDocsPicker() .setInitialView(UiApp.FileType.FOLDERS) **_HOWEVER_** you do not have the ability to select folders through the DocsListDialog ... you may only select individual files...sorry! – Trevor Iampen Mar 15 '14 at 02:41