Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the list of action items from Google Drive API


Hi, everyone.

I have been trying to use Google Drive API for getting a list with the action items assigned in all files (docs or spreadsheets) in my company's domain using Spring Boot and the google-api-services-drive, but I have faced some issues:

  • Looks like there is nothing about action items on the API.
  • Comments are the closest I could get, but they don't include action item information. They only have the emails of people who were mentioned.
  • Documentation looks broad and not precise. For instance, here they say files resources include an indexableText property, but it is not present on the response.
  • As explained in Term for followup, looking for actionitems you can apply a query for getting the files with action items. Why is the fullText field not available in the response, or some other equivalent attribute to see the actual content and use it as a workaround to get the action items?

I just need to know who was assigned to the action item from the comment.

Any ideas?

like image 325
Nico Jones Avatar asked Jun 04 '20 15:06

Nico Jones


People also ask

How do I get a list of files in Google Drive?

Goto the same Google Sheets File and refresh the page. Then you will get the "List Files/Folders" menu, click on it, and select the "List All Files and Folders" item.

How do I see all assigned tasks in Google Drive?

At the bottom of the advanced search box, there is an dropdown menu for Follow up. Select Action Items Only from the Follow up menu, and click Search. You will see a list of all the documents where you've been assigned action items in one place.


1 Answers

Retrieve the action items with Comments: list specifying fields as comments/replies/action

I agree with you that it is not straightfoward, but there is a way to retrieve the full comment content including action items.

  1. Use Files:list specifying q as fullText contains 'followup:actionitems', just as in the post you mentioned

  2. For each of the retrieve items, use the fileId for the method Comments: list

  3. For better understadning specify first the fields for Comments:list as * - this will return you the complete reponse looking as following:
{
 "kind": "drive#commentList",
 "comments": [
  {
   "kind": "drive#comment",
   "id": "AAAAGlyxwAg",
   "createdTime": "2020-06-08T09:04:34.907Z",
   "modifiedTime": "2020-06-08T09:05:07.279Z",
   "author": {
    "kind": "drive#user",
    "displayName": "XXX",
    "photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
    "me": true
   },
   "htmlContent": "+\u003ca href=\"mailto:[email protected]\" data-rawHref=\"mailto:[email protected]\" target=\"_blank\"\[email protected]\u003c/a\u003e Could you please check the spelling?",
   "content": "[email protected] Could you please check the spelling?",
   "deleted": false,
   "resolved": true,
   "quotedFileContent": {
    "mimeType": "text/html",
    "value": "Hello"
   },
   "anchor": "kix.94ksxclyqix",
   "replies": [
    {
     "kind": "drive#reply",
     "id": "AAAAGlyxwAo",
     "createdTime": "2020-06-08T09:05:02.999Z",
     "modifiedTime": "2020-06-08T09:05:02.999Z",
     "author": {
      "kind": "drive#user",
      "displayName": "YYY",
      "photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
      "me": false
     },
     "htmlContent": "Will do!",
     "content": "Will do!",
     "deleted": false
    },
    {
     "kind": "drive#reply",
     "id": "AAAAGlyxwAs",
     "createdTime": "2020-06-08T09:05:07.279Z",
     "modifiedTime": "2020-06-08T09:05:07.279Z",
     "author": {
      "kind": "drive#user",
      "displayName": "YYY",
      "photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
      "me": false
     },
     "deleted": false,
     "action": "resolve"
    }
   ]
  }
 ]
}

This response contains the following information:

  • The quoted file content (the text to which the comment refers)
  • The content of the initial comment and the replies
  • The user to whom the comment was assigned
  • The reply of the user including his user name
  • And finally, the action taked by the user

  1. Now, if you are not interested in all fields but only in the action, you can see that action is a resources nested in comments/replies
  2. To query for action, replace the * in fields with comments/replies/action

as for your question about indexableText, the documentation specifies that it is a property of contentHints and

contentHints
Additional information about the content of the file.
These fields are never populated in responses.

A way to make indexableText "useful" is e.g. apply it in queries like

Files:list with q : fullText contains 'indexableText'

The good new are that if you not happy with the way how actions are retrieved now and can think of a better method to implement it, you can file a Feature request on Google's Public Issue Tracker. If enough users show interest in the feature, Google might implement it in the future.

like image 103
ziganotschka Avatar answered Oct 19 '22 02:10

ziganotschka