添加计划任务与清单

问题描述 投票:0回答:1

我试图创建一个含有清单中的新任务。

我读in this article,我需要做的这两个步骤; 1.创建任务 2. PATCH任务,增加检查的条目。

当试图PATCH添加任务,它不添加任何东西。它只能编辑现有的值,比如“称号”。我找不到任何方式或文档PUT细节,或创建任务时初始POST创建它们。

有人知道怎么做吗?

POST - 创建新任务:

URI: https://graph.microsoft.com/v1.0/planner/tasks
Content-Type : application/json

RAW:
{
  "planId": "{plan_id}",
  "bucketId": "{bucket_id}",
  "title": "Here is a task",
  "checklist": {
    "95e27074-6c4a-447a-aa24-9d718a0b86fa":{
      "@odata.type": "microsoft.graph.plannerChecklistItem",
      "title": "Task details",
      "ischecked": true
    },
    "d280ed1a-9f6b-4f9c-a962-fb4d00dc50ff":{
      "@odata.type": "microsoft.graph.plannerChecklistItem"
    }
  }
}

回应:车身,201次的成功:

BODY:
{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#planner/tasks/$entity",
    "@odata.etag": "W/\"…ETag…\"",
    "planId": "{plan_id}",
    "bucketId": "{bucket_id}",
    "title": "Here is a task",
    "orderHint": "8586523326629295130",
    "assigneePriority": "",
    "percentComplete": 0,
    "startDateTime": null,
    "createdDateTime": "2019-02-04T09:57:02.5480677Z",
    "dueDateTime": null,
    "hasDescription": false,
    "previewType": "automatic",
    "completedDateTime": null,
    "completedBy": null,
    "referenceCount": 0,
    "checklistItemCount": 0,
    "activeChecklistItemCount": 0,
    "conversationThreadId": null,
    "id": "{task_id}",
    "createdBy": {
        "user": {
            "displayName": null,
            "id": "{UID}"
        }
    },
    "appliedCategories": {},
    "assignments": {}
}

还试图把checklistdetails块内,并得到完全相同的结果。

"details": {
  "checklist": { … }
}

PATCH - 更新现有任务:


URI: https://graph.microsoft.com/v1.0/planner/tasks/{task_id}

HEADERS:
If-Match : W/"…ETag…"
Content-type : application/json

RAW:
{
  "title": "New title",
  "checklist": {
    "95e27074-6c4a-447a-aa24-9d718a0b86fa":{
      "@odata.type": "microsoft.graph.plannerChecklistItem",
      "title": "Update task details",
      "ischecked": true
    },
    "d280ed1a-9f6b-4f9c-a962-fb4d00dc50ff":{
      "@odata.type": "microsoft.graph.plannerChecklistItem"
    }
  }
}

回应:空,204次的成功。标题改变,但没有新的检查单项目。

microsoft-graph
1个回答
1
投票

你不能在你正在创建的任务同时更新的细节。该plannerTaskplannerTaskDetails是不同的对象。此外,details property of a plannerTask is read-only

首先,您需要create a plannerTask然后update it's associated plannerTaskDetails

© www.soinside.com 2019 - 2024. All rights reserved.