Shared drive not found while using GDrive.files.list({))

Viewed 3106

I want to get list of files from shared drive, by using react-native-google-drive-api-wrapper library, but i am getting an errorr. here my code.

GoogleSignin.configure({
  scopes: [
  'https://www.googleapis.com/auth/drive',
  'https://www.googleapis.com/auth/drive.file',
],
      webClientId:"xxxxxxx",
      offlineAccess: true,
      //forceConsentPrompt: true,
 })
    await GoogleSignin.getTokens().then(res=>GDrive.setAccessToken(res.accessToken))
          GDrive.init()
          await GDrive.files.list({
            q: "mimeType='application/pdf'",
            fieIds:'*',
            corpora:'drive',
            supportsAllDrives:true,
            includeItemsFromAllDrives:true,
            driveId:'1YAyXfzIAOP5TejUW00RR9jhXaBIXKF8_'
          })
           .then(res=>res.json())
           .then(data=>console.log(data))
           .catch(err=>console.log(err))

I get this errorr, thanks for help.

{"error": {"code": 404, "errors": [[Object]], "message": "Shared drive not found: 1YAyXfzIAOP5TejUW00RR9jhXaBIXKF8_"}}

fixed I provided folderId instead driveId, so you have to change query like this:

GDrive.init()
       GDrive.files.list({
       q: "' folderId ' in parents",
      })
       .then(res=>res.json())
       .then(data=>console.log(data))
       .catch(err=>console.log(err))
1 Answers

Config "driveId" is used to find by Drive ID. Change your config to:

      --
      'q' => "'" . {{YOUR_FOLDER_ID_HERE}} . "' in parents",
      'fields' => "*"
      --
Related