问题描述
我有一个完全构建的 API,可以将任务创建到 MS Teams 中“按计划者和待办事项划分的任务”。
使用的 MS 实际图形 API POST
https://graph.microsoft.com/v1.0/planner/tasks
示例 API:
{
"routeId": "7fcxxxxx-xxxx-xxxx-xxxx-5d35838xxxxx","userId": "77cxxxxx-xxxx-xxxx-xxxx-5f09858xxxxx","tenantId": "dcdxxxxx-xxxx-xxxx-xxxx-31002a1xxxxx","title": "Task: Add you task title","hospitalAssignment": null,"percentComplete": 0,"createdTimestamp": "2021-04-20T01:51:49Z","startDateTimestamp": "2021-04-20T18:10:15Z","dueDate": "2021-11-20T11:47:33.000Z","Notes": "Add some useful notes here","checklistItems": [
{
"title": "itema"
},{
"title": "itemb"
}
],"attachments": [
{
"url": "https://www.google.com","alias": "link"
},{
"url": "https://teams.microsoft.com/file/....","alias": "Test Document 1"
},{
"url": "https://random.sharepoint.com/sites/...","alias": "Test Document 2"
},],"comments": "null,","priority": null
}
点击上述 API 在规划器中创建一个任务,如下所示
所以,这里有一个问题 - 当我尝试点击 link
时,它会将我带到浏览器并打开 google
,这很好。现在,当我点击 Test Document 1
或 Test Document 2
时,它会分别抛出 unkNown error
和 Sorry,something went wrong
。
之后,我手动创建了任务并添加了来自 Add Attachment
的附件并将链接粘贴到那里的文件中,然后单击文件工作并打开文档。 >
解决方法
假设您指的是为 PlannerTask 添加/更新 Planner Task Details;
提供了一个使用您提到的“团队路径”添加(PATCH)pptx 文件的示例。
请注意,路径必须是 (url) 编码的。
任务 - plannerTaskDetail references
https://docs.microsoft.com/en-us/graph/api/resources/plannerexternalreferences?view=graph-rest-1.0
{
"https%3A//contoso%2Esharepoint%2Ecom/teams/agile/documents/AnnualReport%2Epptx":
{
"@odata.type": "microsoft.graph.externalReference",// required in PATCH requests to edit the references on a task
"alias": "Agile Team Annual Report","lastModifiedBy": {
"user": {
"id": "ebf3b108-5234-4e22-b93d-656d7dae5874"
}
},"lastModifiedDateTime": "2015-09-21T17:45:12.039Z","previewPriority": "0009005756397228702","type": "PowerPoint"
}
}