On March 31, 2021, support for Google Photos and other non-Drive file types, such as Webcam and YouTube videos, will be deprecated.

Picker API Reference

The following is a list of classes, methods, and enumerated types available in the Google Picker API. All of these elements belong to the namespace google.picker.* There are two types of classes and enumerated types: those which are used to build and configure the Google Picker, and those which are returned by the Google Picker once the user has selected an item.

Configuration Classes and Types

The following classes and enumerated types are used to build and configure the Google Picker.

DocsUploadView

Use DocsUploadView to upload documents to Google Drive.

DocsUploadView()Constructor.
DocsUploadView.setIncludeFolders(boolean)Allows the user to select a folder in Google Drive to upload to.
DocsUploadView.setParent(string)Sets the upload destination to the specified folder. This overrides ".setIncludeFolders" to false.

DocsView

DocsView is a subclass of View that can be used for Google Drive views.

DocsView(ViewId | undefined)Constructor. The ViewId must be one of the Google Drive views. Default is ViewId.DOCS.
DocsView.setEnableDrives(boolean)Shows shared drives and the files they contain. Note: Feature.SUPPORT_DRIVES needs to be enabled when enabling this.
DocsView.setIncludeFolders(boolean)Show folders in the view items. Do not combine with setOwnedByMe. When setIncludeFolders(true) is set, setOwnedByMe is ignored.
DocsView.setSelectFolderEnabled(boolean)Allows the user to select a folder in Google Drive.
DocsView.setMode(DocsViewMode)Selects which mode the view uses to display the documents.
DocsView.setOwnedByMe(boolean | undefined)Filters the documents based on whether they are owned by the user, or shared with the user. Do not combine this setting with setIncludeFolders. When setIncludeFolders(true) is set, setOwnedByMe is ignored.
DocsView.setParent(string)Sets the initial parent folder to display.
DocsView.setStarred(boolean)Filters the documents based on whether they are starred by the user.

DocsViewMode

DocsViewMode is an enumerated type for displaying data within a DocsView. Use these values in calls to DocsView.setMode.

DocsViewMode.GRIDDisplay documents in a thumbnail grid.
DocsViewMode.LISTDisplay documents in a detailed list.

Feature

Feature is an enumerated type, for turning on/off features for various views. Use these values in calls to PickerBuilder.enableFeature and PickerBuilder.disableFeature.

Feature.MINE_ONLYShow only documents owned by the user when showing items from Google Drive.
Feature.MULTISELECT_ENABLEDAllow user to choose more than one item.
Feature.NAV_HIDDENHide the navigation pane. If the navigation pane is hidden, users can only select from the first view chosen.
Feature.SIMPLE_UPLOAD_ENABLEDFor photo uploads, controls whether per-photo selection (as opposed to per-album) selection is enabled.
Feature.SUPPORT_DRIVESWhether shared drive items should be included in results. Before enabling this make sure to refer Google Drive API documentation for enabling shared drives and make any necessary Drive Rest API changes.

ImageSearchView

ImageSearchView is a subclass of View. Finer aspects of image searchs can be controlled using this class.

ImageSearchView()Constructor.
ImageSearchView.setLicense(ImageSearchView.License)Set the License filter for images. This allows clients to filter items returned based on Creative Commons attributes. For more details, read Usage Rights.
ImageSearchView.License.NONENo Creative Commons attributes required. All images.
ImageSearchView.License.COMMERCIAL_REUSEExcludes cc_noncommercial.
ImageSearchView.License.​COMMERCIAL_REUSE_WITH_MODIFICATIONExcludes cc_noncommercial and cc_nonderived. Default choice.
ImageSearchView.License.REUSENo exclusions for images with Creative Common attributes.
ImageSearchView.License.REUSE_WITH_MODIFICATIONExcludes cc_nonderived.
ImageSearchView.setSite(string)Add a site filter for image source. E.g. flickr.com. Only the last site set by setSite is honored (i.e. it is not cumulative.)
ImageSearchView.setSize(ImageSearchView.Size)Set the minimum size of image.
ImageSearchView.Size.SIZE_QSVGAImages at least 400x300 in either aspect ratio.
ImageSearchView.Size.SIZE_VGAImages at least 640x480.
ImageSearchView.Size.SIZE_SVGAImages at least 800x600.
ImageSearchView.Size.SIZE_XGAImages at least 1024x768.
ImageSearchView.Size.SIZE_WXGAImages at least 1280x800.
ImageSearchView.Size.SIZE_WXGA2Images at least 1440x900.
ImageSearchView.Size.SIZE_2MPImages at least 2 megapixels.
ImageSearchView.Size.SIZE_4MPImages at least 4 megapixels.
ImageSearchView.Size.SIZE_6MPImages at least 6 megapixels.
ImageSearchView.Size.SIZE_8MPImages at least 8 megapixels.
ImageSearchView.Size.SIZE_10MPImages at least 10 megapixels.
ImageSearchView.Size.SIZE_12MPImages at least 12 megapixels.
ImageSearchView.Size.SIZE_15MPImages at least 15 megapixels.
ImageSearchView.Size.SIZE_20MPImages at least 20 megapixels.
ImageSearchView.Size.SIZE_40MPImages at least 40 megapixels.
ImageSearchView.Size.SIZE_70MPImages at least 70 megapixels.
ImageSearchView.Size.SIZE_140MPImages at least 140 megapixels.

MapsView

MapsView is a subclass of View. Control the initial view for map selection using this class.

MapsView()Constructor.
MapsView.setCenter(number, number)Center the initial map view at a given coordinate. The arguments are latitude and longitude values, respectively.
MapsView.setZoom(number)Set the initial zoom level. Valid range is 0 to 21; a higher value indicates a greater zoom.

PhotoAlbumsView

PhotoAlbumsView is a subclass of View that can be used to select albums from Google Photos albums.

PhotoAlbumsView()Constructor.

PhotosView

PhotosView is a subclass of View. Finer aspects of photos selection can be controlled using this class.

PhotosView()Constructor.
PhotosView.setParent(string)Sets the initial parent album to display.
PhotosView.setType(PhotosView.Type)Filter photos shown in the view by PhotosView.Type.
PhotosView.Type.UPLOADEDSelect from the user's most recently uploaded photos, from any album, with the most recently uploaded photos shown first.

Picker

Picker is the top level object representing the UI action with the user. These objects are not created directly, but instead use the PickerBuilder object.

Picker.isVisible()Get a boolean indicating the current Picker visibility.
Picker.setCallback(function(object))Specify the callback method called whenever the user has selected an item (or canceled.)
Picker.setRelayUrl(string)Specify a relay URL to circumvent cross-domain issues.
Picker.setVisible(boolean)Control the visibility of the Picker object.
Picker.dispose()Disposes the Picker object.

PickerBuilder

PickerBuilder is used to create Picker objects. Except where noted otherwise, the return type of methods below are of type PickerBuilder, allowing you to chain one call after another. See the Google Picker example for typical use.

PickerBuilder()Constructor.
PickerBuilder.addView(View | ViewId)Add a View to the navigation pane.
PickerBuilder.addViewGroup(ViewGroup)Add a ViewGroup to the top-level navigation pane.
PickerBuilder.build()Construct the Picker object. The Picker object is returned.
PickerBuilder.disableFeature(Feature)Disable a picker feature.
PickerBuilder.enableFeature(Feature)Enable a picker feature.
PickerBuilder.getRelayUrl()Get the relay URL, used for gadgets.rpc.
PickerBuilder.getTitle()Get the dialog title.
PickerBuilder.hideTitleBar()Disable the title bar from being shown. To re-enable, call setTitle with a non-empty title or undefined.
PickerBuilder.isFeatureEnabled(Feature)Check if a picker Feature is enabled.
PickerBuilder.setAppId(string)Sets the Google Drive App ID needed to allow application to access the user's files via the Google Drive API.
PickerBuilder.setCallback(method)Set the callback method. This method is called when the user selected items or cancels. The callback method receives a single callback object. The structure of the callback object is described in the JSON Guide.
PickerBuilder.setDeveloperKey(string)Sets the Browser API key obtained from Google API Console. See the Developer's Guide for details on how to obtain the Browser API key.
PickerBuilder.setDocument(document)Set the document.
PickerBuilder.setLocale(string)ISO 639 language code. If the language is not supported, en-US is used. This method provides an alternative to setting the locale at google.load() time. See the Developer's Guide for a list of supported locales.
PickerBuilder.setMaxItems(number)Sets the maximum number of items a user can select.
PickerBuilder.setOAuthToken(string)Sets an OAuth token to use for authenticating the current user. Depending on the scope of the token, only certain views display data. Valid scopes are Google Docs, Drive, Photos, YouTube.
PickerBuilder.setOrigin(string)Sets the origin of picker dialog. The origin should be set to the window.location.protocol + '//' + window.location.host of the top-most page, if your application is running in an iframe.
PickerBuilder.setRelayUrl(string)Set the relay URL, used for gadgets.rpc.
PickerBuilder.setSelectableMimeTypes(string)Set the list of selectable MIME types. Use commas to separate MIME types if more than one is required.
PickerBuilder.setSize()Set the preferred dialog size. The dialog is auto-centered. It has a minimum size of (566,350) and a maximum size of (1051,650).
PickerBuilder.setTitle(string)Set the dialog title.
PickerBuilder.toUri()Returns the URI generated by this builder.

ResourceId

ResourceId is a static class used to generate resource IDs suitable for the Google Documents List API.

ResourceId.generate(Document)Map a document object to a resource ID.

VideoSearchView

VideoSearchView is a subclass of View. Use this class to select URLs of videos.

VideoSearchView()Constructor.
VideoSearchView.setSite(string)Constrain the video search results to a particular domain.
VideoSearchView.YOUTUBEA string constant suitable for the VideoSearchView.setSite() method.

View

View is the abstract base class for the various View classes, such as ImageSearchView.

View(ViewId)Constructor.
View.getId()Returns the ViewId for this view.
View.setMimeTypes(string)Sets the MIME types included in the view. Use commas to separate MIME types if more than one is required. If you don't set MIME types, files of all MIME types are displayed in the view.
View.setQuery(string)For views involving searches, prepopulate the search query with these terms.

ViewGroup

ViewGroup is a visual grouping of views. The root item of the ViewGroup itself must be a View.

ViewGroup(View | ViewId)A ViewGroup is a visual grouping of Views in the navigation pane. The root item of the ViewGroup itself must be View.
ViewGroup.addLabel(string)Add a label to this ViewGroup.
ViewGroup.addView(ViewId | View)Add a view to the ViewGroup. The View can be represented by a view-derived object, or simply by ViewId.
ViewGroup.addViewGroup(ViewGroup)Nest a ViewGroup within the current ViewGroup.

ViewId

ViewId is an enumerated type, used for constructing View and ViewGroup objects.

ViewId.DOCSAll Google Drive document types.
ViewId.DOCS_IMAGESGoogle Drive photos.
ViewId.DOCS_IMAGES_AND_VIDEOSGoogle Drive photos and videos.
ViewId.DOCS_VIDEOSGoogle Drive videos.
ViewId.DOCUMENTSGoogle Drive Documents.
ViewId.DRAWINGSGoogle Drive Drawings.
ViewId.FOLDERSGoogle Drive Folders.
ViewId.FORMSGoogle Drive Forms.
ViewId.IMAGE_SEARCH Google Image Search.
ViewId.PDFSPDF files stored in Google Drive.
ViewId.PHOTO_ALBUMS Google Photos albums.
ViewId.PHOTO_UPLOAD Upload to Google Photos.
ViewId.PHOTOS Photos from Google photos.
ViewId.PRESENTATIONSGoogle Drive Presentations.
ViewId.RECENTLY_PICKED A collection of most recently selected items.
ViewId.SPREADSHEETSGoogle Drive Spreadsheets.
ViewId.VIDEO_SEARCH Google Video Search.
ViewId.WEBCAM Webcam photos.
ViewId.YOUTUBE Your YouTube videos.

WebCamView

WebCamView derives from View and is used to record videos or take photos using a web camera.

WebCamView(WebCamViewType | undefined)Constructor.

WebCamViewType

WebCamViewType is an enumerated type, used for constructing WebCamViews.

WebCamViewType.STANDARDTake a photo using a web camera.

Callback Types

The following enumerated types are found in callback data returned by the Google Picker API.

Action

Action is an enumerated type representing the action taken by the user to dismiss the dialog. This value is in the Response.ACTION field in the callback data.

Action.CANCELUser canceled the picker dialog.
Action.PICKEDUser has chosen at least one item.

Audience

Audience is an enumerated type representing the audience of a photo album. This value is in the Document.AUDIENCE field of the Document object when a Google Photos album is selected.

Audience.OWNER_ONLYContents are accessible only to the owner.
Audience.LIMITEDContents are accessible to users other than the owner.
Audience.PUBLICContents are accessible to everyone.

Document

Document is an enumerated type used to convey information about a specific selected item. Only fields which are relevant to the selected item are returned. This value is in the Response.DOCUMENTS field in the callback data.

Document.ADDRESS_LINESThe address of the selected location.
Document.AUDIENCE An Audience type used to convey the audience of a Google Photos album.
Document.DESCRIPTIONA user-contributed description of the selected item.
Document.DURATIONThe duration of a selected video.
Document.EMBEDDABLE_URLA URL for this item suitable for embedding in a web page.
Document.ICON_URLA URL to an icon for this item.
Document.IDThe id for the selected item.
Document.IS_NEWReturns true if the selected item was just uploaded.
Document.LAST_EDITED_UTCThe timestamp describing when this item was last edited.
Document.LATITUDEThe latitude of the selected location.
Document.LONGITUDEThe longitude of the selected location.
Document.MIME_TYPEThe MIME type of this item.
Document.NAMEThe name of this item.
Document.NUM_CHILDRENThe number of children contained in this item. For example, the number of files in the selected folder.
Document.PARENT_IDThe parent id of this item. For example, the folder containing this file.
Document.PHONE_NUMBERSThe phone number of the selected location.
Document.SERVICE_IDA ServiceId describing the service this item was selected from.
Document.THUMBNAILSAn array of Thumbnails which describe the attributes of a photo or video. Thumbnails aren't returned if the selected items belong to Google Drive.
Document.TYPEThe Type of the selected item.
Document.URLA URL to this item.

Response

Response is an enumerated type used to convey information about the user's selected items.

Response.ACTIONAn Action type representing the action taken by the user to dismiss the dialog.
Response.DOCUMENTSAn array of Documents selected by the user.
Response.PARENTSThe IDs of the parent folders for the selected items. (For example, IDs of the parent folders whose files were selected.)
Response.VIEWThe View the user selected these items from.

service-id

ServiceId is an enumerated type used to describe the service the item was selected from. This value is in the Document.SERVICE_ID field of the selected Document.

ServiceId.DOCSGoogle Drive.
ServiceId.MAPSGoogle Maps.
ServiceId.PHOTOSGoogle Photos.
ServiceId.SEARCH_APIGoogle Web Search.
ServiceId.URLA user-supplied URL.
ServiceId.YOUTUBEYouTube.

thumbnail

Thumbnail is an enumerated type used to convey information about a selected photo or video. This value can be found in the Document.THUMBNAILS field of a selected Document.

Thumbnail.HEIGHTThe height of the photo or video in pixels.
Thumbnail.WIDTHThe width of the photo or video in pixels.
Thumbnail.URLA URL to the selected photo or video.

type

Type is an enumerated type used to catorgize the selected item. This value can be found in the Document.TYPE field of a selected Document.

Type.ALBUM The item is a Google Photos album.
Type.DOCUMENTThe item is a document.
Type.LOCATIONThe item is a location.
Type.PHOTOThe item is a photo.
Type.URLThe item is a URL.
Type.VIDEOThe item is a video.