How can i add a comment using GRAPH API in Planner

Brass Contributor

Hi,

 

I'm having issues adding comments to tasks in planner using the graph api. I tried looking at the conversation id and tried posting to corresponding O365 but had no succes on adding comments to tasks. Can anybody help me out with this?

 

Regards,

Robin

9 Replies

@Eray Chou, do you know who might be able to help answer this question?

Yes I would like this answer too. It's not clear from the MetaData in Graph where the description field resides. Doesn't seem to be part of the Task but there is a "hasDescription" field set to true when a description is added through the UI.
You need to use POST /groups/<id>/threads to post the conversation
https://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/group_post_threads

To update that conversation to task use conversationThreadId
https://graph.microsoft.io/en-us/docs/api-reference/beta/api/task_update
Unfortunately getting them works, but the post doe not. It adds them to the office 365 group but they are not visible in the planner

Hello,

Sorry "A year later", I was looking to do the same thing and find this post.
I used https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/conversationthread_reply to understand how to publish a new comment from Graph

with POST https://graph.microsoft.com/v1.0/groups/[GroupID]/threads/[ConversationID]/reply

 

And body content like

{
  "post": {
    "body": {
      "contentType": "1",
      "content": "Hello from Graph"
    }
  }
}

To find the conversationID i use:
https://graph.microsoft.com/v1.0/groups/[GroupID]/threads

or

https://graph.microsoft.com/v1.0/Planner/Plans/[PlanId]/tasks
or
https://graph.microsoft.com/v1.0/Planner/tasks/[TaskID]

 

To find PlanID or GroupId, just browse to you planner, it's in the URL

 

Let's play with this :)

/Christophe

I tried with graph explorer it shows success but it doesnot post the comment in the planner task@Christophe DION What am I missing here. Problem is I can get conversation thread id once the first comment is posted but to post the first comment your way is not working

Christophe's method works great for tasks that already have a conversationId, but can't be used to post the first comment on a new task.
If there is no conversationId you can create a new conversation thread for the group corresponding to the plan. Afterwards update the conversationId of the task.

Keep in mind - This requires Group scopes which require an admin consent. So if you are building an app which should not use admin consent, sending comments is currently not possible.