0

i am very new to MS Graph and Planner but i would like to generate a script where i define a Plan with mutiple tasks and i only have to specify the startDateTime of the first Task, so the dueDateTimes will be calculated automatically for each task.

  1. First how to create multiple tasks in one script?

  2. How can i calculate and modify the dueDateTime type?

POST https://graph.microsoft.com/v1.0/planner/tasks
Content-type: application/json
Content-length: 285

{
    "planId": "PLAN1",
    "bucketId": "BUCKETID",
    "title": "New Task1",
    "startDateTime1": "2021-07-01T10:00:00Z",
    "dueDateTime1": "'startDatetime1+15days'",
    "assignments": {}
}
{
    "planId": "PLAN1",
    "bucketId": "BUCKETID2",
    "title": "New Task2",
    "startDateTime2": "'dueDateTime1+10days'",
    "dueDateTime2": "'startDateTime2+10days'",
    "assignments": {}
}

....(adding 8Tasks all Dates depending on the first startDate)

Hope this example with some pseudo-code helps

Thank you very much in advance

Regards vicces

vicces
  • 1
  • 1
  • Hi and welcome to stackoverflow. It will be easier for people to help you if you can edit your question to include the code you are having trouble with and show what you've tried - especially if you can narrow it down to just the bit where you are having the problem. You might find reviewing this guideline to be helpful: stackoverflow.com/help/minimal-reproducible-example – morric Jul 02 '21 at 21:30
  • 1
    As mentioned by @morric you can edit the question to be more specific. For a start you can check the [MS Graph Todo Docs](https://learn.microsoft.com/en-us/graph/api/resources/todotask?view=graph-rest-1.0) which has details of how to create and update todo tasks. – Danstan Jul 05 '21 at 14:44
  • Hey thanks for your advise, i just updated the question and added some example code – vicces Jul 07 '21 at 08:36

1 Answers1

1

Planner (and most other services/APIs) will not accept a calculation as an input. You'll need to calculate the actual date in your script and pass the result to Planner so that the task has the correct start and due dates when it is created.

To create multiple tasks in one go, you can use batching. This does not allow calculation either, you'll still need to provide the values calculated by your script.

Tarkan Sevilmis
  • 1,443
  • 7
  • 9