问题
I wanted to write a quick script to remind myself of follow-up action items put on the various google documents, out of google drive to benefit from the API list(). However, it seems the followup:actionitems
search query is not working with the API, as the search term is not known. It returns a 400 error.
For example, doing this:
results = service.files().list(q="followup:actionitems",
pageSize=50,
pageToken=page_token,
fields="nextPageToken, files(id, name)").execute()
results in:
Traceback (most recent call last):
File "./reminder.py", line 49, in <module>
main()
File "./reminder.py", line 38, in main
fields="nextPageToken, files(id, name)").execute()
File "/home/x/.virtualenvs/gdocs-followup-reminder-7WeAWiqi/lib/python3.7/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
return wrapped(*args, **kwargs)
File "/home/x/.virtualenvs/gdocs-followup-reminder-7WeAWiqi/lib/python3.7/site-packages/googleapiclient/http.py", line 856, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/drive/v3/files?q=followup%3Aactionitems&pageSize=50&fields=nextPageToken%2C+files%28id%2C+name%29&alt=json returned "Invalid Value">
Is there something I am missing? Not the right usage? Or is it planned to have that in the future?
回答1:
You can accomplish that setting the q
parameter to
fullText contains 'followup:actionitems' and trashed = false
returns the same files as Google Drive UI does
回答2:
The q parameter is very nice it lets you search for files and directories in Google drive. However it does not let you search on all of the properties of a file. As far as i know followup action items is not one of them.
Documentation
The Google docs api to my knowledge does not have a q parameter for searching the contents of a file.
Really i think that followup:actionitems
is out of scope for the Google drive api its just a file storage api it doesn't keep track of any settings you setup in the Google drive web application. as you can see from the file.resource object that isnt even a properly on a file in google drive api
来源:https://stackoverflow.com/questions/58010474/term-for-followup-looking-for-actionitems