问题描述
我对 MS Graph 和 Planner 非常陌生,但我想生成一个脚本,在其中定义一个包含多个任务的计划,我只需要指定第一个任务的 startDateTime,因此将自动计算每个任务的 DueDateTimes任务。
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": {}
}
希望这个带有一些伪代码的例子有帮助
非常感谢您提前
向恶人问好
解决方法
Planner(和大多数其他服务/API)不接受计算作为输入。您需要在脚本中计算实际日期并将结果传递给 Planner,以便任务在创建时具有正确的开始日期和截止日期。
要一次性创建多个任务,您可以使用 batching。这也不允许计算,您仍然需要提供脚本计算的值。