Search code examples
pythongoogle-drive-apigoogle-docs-api

Term for followup, looking for actionitems


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?


Solution

  • 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