0

我有一个完全构建的 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 1Test Document 2它分别抛出一个unknown errorSorry, something went wrong

之后,我手动创建了任务并从中添加附件Add Attachment并将链接粘贴到那里,然后单击文件工作并打开文档。

4

1 回答 1

0

假设您指的是为 PlannerTask 添加/更新Planner Task Details

提供了一个示例,使用您提到的“团队路径”添加(PATCH)pptx 文件。
请注意,路径必须是(url)编码的。

任务 - plannerTaskDetail <参考

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"
  }
}
于 2021-04-20T14:30:35.960 回答