无法在Microsoft Graph Explorer中更新taskDetails

时间:2017-04-11 21:16:00

标签: rest web-applications microsoft-graph

我正在尝试的内容:

Update taskDetails上关注Microsoft Graph Explorer的文档后,我正在尝试发送PATCH请求:

https://graph.microsoft.com/beta/tasks/{Id}/details

请求标题:

Content-type: application/json
Prefer: "return=represent"
If-Match: {@odata.etag from a successful prior GET on taskDetails}

请求正文:

{
  "description": "My new description",
  "previewType": "description",
  "references": {},
  "checklist": {}
}

响应:

client-request-id: {some Id}
content-type: application/json
cache-control: private
request-id: {some Id}
Status Code: 412     <--- Pre-condition not met!
{
    "error": {
        "code": "UnknownError",
        "message": "",
        "innerError": {
            "request-id": "{some Id}",
            "date": "{date}"
        }
    }
}

使用Chrome开发者工具解析响应标题

HTTP/1.1 412 Precondition Failed
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: application/json
request-id: {some Id}
client-request-id: {some Id}
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West US","Slice":"SliceB","ScaleUnit":"002","Host":"AGSFE_IN_1","ADSiteName":"WST"}}
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, Location, Preference-Applied, Content-Range, request-id, client-request-id
Duration: 68.3028
Date: {date}

关于规划师的说明

奇怪的是,看来Planner使用完全不同的API来更新taskDetails,并且没有所述API的文档。

任何帮助将不胜感激;这是我们工作流程中程序化计划程序访问的企业部署。

1 个答案:

答案 0 :(得分:1)

我发布问题12小时后,微软推动了Graph Planner API的重大更新。这个问题现在已经解决了。

更新任务说明的过程是:

<强>接头

If-Match: {etag}

<强>有效载荷

{
  "description": "Your new description"
}

关键是使用taskDetails对象中的etag,任务对象。