7


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?

Nico Jones
  • 211
  • 1
  • 6

1 Answers1

3

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:YYY@YYY.com\" data-rawHref=\"mailto:YYY@YYY.com\" target=\"_blank\"\u003eYYY@YYY.com\u003c/a\u003e Could you please check the spelling?",
   "content": "+YYY@YYY.com 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.

ziganotschka
  • 25,866
  • 2
  • 16
  • 33
  • Thanks a lot, but I am not sure this is what I want. When you create a comment in a Google Drive file and you mention someone using `+name@domain` you are given the possibility of assigning the action item to one of those people you mentioned. If you do, this person will be responsible for resolving the comment. Sorry, but I can't see that in the API response you shared. Anyways, I will take a second look to the API more carefully. Thank you for your time! – Nico Jones Jun 10 '20 at 13:04
  • This is true for more than one mentioned person, you won't know who is the assigned one. You'd probably have to file a feature request to ask Google to provide this information. – ziganotschka Jun 11 '20 at 09:57
  • Yea, it looks like. Thanks for clarifying this! – Nico Jones Jun 12 '20 at 13:00