问题
Request parameters:
"q": "appProperties has {key = 'hah' and value = 'vah'}",
"fields": "files (id, name, appProperties)"
By trying the files.list request in the environment of the Google API docks (which is Try it), the request passes and the data is returned correct.
Trying to execute the same request from the application, the request passes, but I get an empty list of files
{
"kind": "drive # fileList",
"incompleteSearch": false,
"files": []
}
Yes, the "incompleteSearch"
header also comes: false, but in other queries, even with such a header, the data comes in correctly (maybe you should use nextPageToken?). Moreover, if the same request is made via GAPI (and not via an HTTP, XHR request), then an empty list of files will simply come.
There are no problems with other queries. All rights are granted (for the time being for the test). Other requests are correct. The request is made directly from the browser.
回答1:
It's very simple. appPropperties is a private field and is available only to the application that added it.
In this case, Google API Doc was one application, and mine was another.
Therefore, I could not get the data that was needed, because I did not think that Google’s docks are considered to be another application (although this is logical). Implementing the function to add these attributes from the application when creating/update a file - everything worked.
来源:https://stackoverflow.com/questions/56544174/gapi-google-api-drive-file-request-with-attribute-appproperties-does-not-wo