Microsoft Graph:无法创建具有到期日期的计划任务
Microsoft Graph: Can't create a planner task with expiration date
我使用以下 JSON 正文创建了一个 Microsoft Graph 请求:
{
"planId":"uiceFoBwgUmRrejVaf0z1ZcADEOr",
"title":"test task",
"assignments":{
"caf39f72-6600-41f7-a30a-2574cfa831af":{
"@odata.type":"#microsoft.graph.plannerAssignment",
"orderHint":" !"
}
},
"dueDateTime":{
"dateTime":"2021-08-29T04:00:00:00Z",
"timeZone":"GMT+1"
}
}
我在获得授权时通过 HTTP POST 将正文发送到 https://graph.microsoft.com/v1.0/planner/tasks。这是它给我的信息:
{
"error": {
"code": "",
"message": "The request is invalid:\r\nAn unexpected 'StartObject' node was found for property named 'dueDateTime' when reading from the JSON reader. A 'PrimitiveValue' node was expected.",
"innerError": {
"date": "2020-12-09T10:51:41",
"request-id": "f5acd6d0-f23a-48ac-ad14-5cb086695104",
"client-request-id": "11d32e3c-2093-0aba-5740-45174cec76ac"
}
}
}
这个错误是什么意思?我是否输入了错误的 dueDateTime
参数?还是需要另一个参数才能工作?
提前致谢
Planner 截止日期是 DateTimeOffset,您尝试传入的结构是 DateTimeTimeZone。
您的输入应如下所示:
"dueDateTime":"2021-08-29T04:00:00+01:00",
您可以从文档中阅读有关属性及其类型的更多信息 here。
我使用以下 JSON 正文创建了一个 Microsoft Graph 请求:
{
"planId":"uiceFoBwgUmRrejVaf0z1ZcADEOr",
"title":"test task",
"assignments":{
"caf39f72-6600-41f7-a30a-2574cfa831af":{
"@odata.type":"#microsoft.graph.plannerAssignment",
"orderHint":" !"
}
},
"dueDateTime":{
"dateTime":"2021-08-29T04:00:00:00Z",
"timeZone":"GMT+1"
}
}
我在获得授权时通过 HTTP POST 将正文发送到 https://graph.microsoft.com/v1.0/planner/tasks。这是它给我的信息:
{
"error": {
"code": "",
"message": "The request is invalid:\r\nAn unexpected 'StartObject' node was found for property named 'dueDateTime' when reading from the JSON reader. A 'PrimitiveValue' node was expected.",
"innerError": {
"date": "2020-12-09T10:51:41",
"request-id": "f5acd6d0-f23a-48ac-ad14-5cb086695104",
"client-request-id": "11d32e3c-2093-0aba-5740-45174cec76ac"
}
}
}
这个错误是什么意思?我是否输入了错误的 dueDateTime
参数?还是需要另一个参数才能工作?
提前致谢
Planner 截止日期是 DateTimeOffset,您尝试传入的结构是 DateTimeTimeZone。
您的输入应如下所示:
"dueDateTime":"2021-08-29T04:00:00+01:00",
您可以从文档中阅读有关属性及其类型的更多信息 here。