Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google drive api 如何将Google Drive Picker UI限制为仅显示Google文档?_Google Drive Api_Google Picker - Fatal编程技术网

Google drive api 如何将Google Drive Picker UI限制为仅显示Google文档?

Google drive api 如何将Google Drive Picker UI限制为仅显示Google文档?,google-drive-api,google-picker,Google Drive Api,Google Picker,建议我可以使用addView()函数指定包含哪些Google驱动器项。这很好,但尽管如此,建议只查看Google文档-Google.picker。​ViewId.DOCUMENTS似乎还包括上传到驱动器的任何文件,这些文件是文档,例如MS Word格式、Open Office格式、纯文本和富文本格式 有没有办法限制选取者只向用户提供谷歌文档 为了清楚起见,这里是我的代码来实例化选择器 this.picker = new google.picker.PickerBuilder().

建议我可以使用
addView()
函数指定包含哪些Google驱动器项。这很好,但尽管如此,建议只查看Google文档-
Google.picker。​ViewId.DOCUMENTS
似乎还包括上传到驱动器的任何文件,这些文件是文档,例如MS Word格式、Open Office格式、纯文本和富文本格式

有没有办法限制选取者只向用户提供谷歌文档

为了清楚起见,这里是我的代码来实例化选择器

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

因此,谷歌将硬盘与文档相结合的重新命名导致了一些不一致的命名。Google Drive文档实际上是指存储在Google Drive中的任何文档,包括但不限于问题中列出的文件类型

为了解决这个问题,您可以创建一个视图,而不是使用现有的视图,并指定您感兴趣的MIME类型

这是密码,以防其他人发现自己卡住了

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);
感谢Google Drive开发者社区中的一位用户在G+


因此,谷歌将硬盘与文档相结合的重新命名导致了一些不一致的命名。Google Drive文档实际上是指存储在Google Drive中的任何文档,包括但不限于问题中列出的文件类型

为了解决这个问题,您可以创建一个视图,而不是使用现有的视图,并指定您感兴趣的MIME类型

这是密码,以防其他人发现自己卡住了

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);
感谢Google Drive开发者社区中的一位用户在G+