Question

The reference guide suggests that I can use the addView() function to specify which Google Drive items are included. That's great but despite this the recommended view for Google Documents only - google.picker.​ViewId.DOCUMENTS seems to also include any files that are uploaded to drive and are a document, e.g. MS Word formats, Open Office Formats, Plain Text and Rich Text Formats.

Is there any way to limit the Picker to just offer the user Google Documents?

Just for clarity here's my code to instantiate the Picker.

this.picker = new google.picker.PickerBuilder().
            addView(google.picker.ViewId.DOCUMENTS).
            setAppId(this.clientId).
            setOAuthToken(accessToken).
            setCallback(this._pickerCallback.bind(this)).
            build().
            setVisible(true);
Was it helpful?

Solution

So it transpires that Google's rebrand that combined Drive with Docs resulted in some inconsistent naming. Google Drive Documents actually refers to any Document stored in Google Drive, including but not limited to those file types listed in the question.

To get around this you can create a View rather than use an existing View and specify the MIME types you're interested in being able to list.

Here's the code incase anyone else find's themselves stuck.

var view = new google.picker.DocsView(google.picker.ViewId.DOCUMENTS)
    .setMimeTypes("application/vnd.google-apps.document");

this.picker = new google.picker.PickerBuilder().
            addView(view).
            setAppId(this.clientId).
            setOAuthToken(accessToken).
            setCallback(this._pickerCallback.bind(this)).
            build().
            setVisible(true);

Thanks for this goes to a user in the Google Drive Developers community on G+

Original Post in the G+ Community

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top