0

I want to create a spfx webpart to create a tasks in the teams channel

IS there any API for creating tasks in teams channel

Below is the image of my channel Task tab

enter image description here

I am new to Graph API Thanks in advance

2
  • Do you want to create planner tasks or to-do tasks? Check this & let me know if this works for you. Commented Sep 16, 2021 at 6:19
  • Please check the updated question with image teams channel task where i want to create task using Graph APII Commented Sep 16, 2021 at 7:13

1 Answer 1

1

You can use below endpoint to create new task inside any planner.

https://graph.microsoft.com/v1.0/planner/tasks

Request body

    {
  "planId": "xqQg5FS2LkCp935s-FIFm2QAFkHM",
  "bucketId": "hsOf2dhOJkqyYYZEtdzDe2QAIUCR",
  "title": "Update client list",
  "assignments": {
    "fbab97d0-4932-4511-b675-204639209557": {
      "@odata.type": "#microsoft.graph.plannerAssignment",
      "orderHint": " !"
    }
  }
}

Now if you noticed what you need is to find a plan Id for that particular channel's planner and its bucket id

Below are the steps you can follow to get

To get Plan Id - Open the planner in a particular channel and click on the website icon, this will open the planner in the browser and in the end, you will find the plan id

enter image description here

To get bucket ID

We would have to make the below API call

/planner/plans/{plan-id}/buckets

This will list down all the buckets inside the plan and you can find bucket id.

Use both above information to make actual create task call as mentioned in above step.

Hope this helps..

3
  • Thanks it worked But how can we create task with others fields like (attachments ,Due Date,StartDate,priority) options in the request body Commented Sep 23, 2021 at 5:22
  • 1
    docs.microsoft.com/en-us/graph/api/resources/… - you can find here properties name which you can send. Commented Sep 23, 2021 at 6:41
  • 1
    I don;t see way to add attachment but would have to check if that works Commented Sep 23, 2021 at 6:41

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.