Home > Software engineering >  How to show both folders and JSON files in Google Drive Picker?
How to show both folders and JSON files in Google Drive Picker?

Time:10-12

I want to have a Google picker dialog that is showing folders and JSON files. I'm using "react-google-drive-picker" package. It has a method named openPicker that we can pass the target mime type to it as an argument and see all files with this type.

openPicker({
  clientId: CLIENT_ID,
  developerKey: API_KEY,
  setIncludeFolders: true,
  setSelectFolderEnabled: true,
  viewMimeTypes: "application/vnd.google-apps.folder and application/json",
});

I know the mimeType of folders is application/vnd.google-apps.folder and the mimeType of JSON files is `application/json in Google drive API.

But I don't how should I mix these 2 mimeTypes to show both folders and JSONs in my picker.

CodePudding user response:

Use comma to set multiple MIME types. e.g.

viewMimeTypes: "application/vnd.google-apps.folder,application/json",

docs

  • Related