Search code examples
google-app-maker

AppMaker Drive.Files.list query for properties


function searchDrive(teamDriveId) { var args = { corpora: 'teamDrive', includeTeamDriveItems: true, supportsTeamDrives: true, teamDriveId: teamDriveId, q: "properties has { key = 'source' and value = 'internet' }" }; return Drive.Files.list(args).items;

results in: GoogleJsonResponseException: Invalid query at searchDrive (ServerScript:9)

I have ran the same query in the API Explorer and received successful results. I have ran other queries (mimeType='image/jpeg') using the Drive.Files.list API in AppMaker and received successful results.

Has anyone queried 'properties' using this API? Does anyone have any insights into what I am doing wrong?

Thanks


Solution

  • In order to make a proper query you need to include the visibility property; hence it should be:

    function searchDrive(teamDriveId) {
      var args = {
        corpora: 'teamDrive',
        includeTeamDriveItems: true,
        supportsTeamDrives: true,
        teamDriveId: teamDriveId,
        q: "properties has { key = 'source' and value = 'internet' and visibility='PRIVATE' }"
      };
      return Drive.Files.list(args).items;
    }
    

    Please note the visibility='PRIVATE' part. Possible values are PRIVATE and PUBLIC according to the documentation.