如何使用 beta Microsoft Graph API 在计划程序中删除带有外部引用的任务详细信息引用

How to remove a reference of task details with an external reference in planner using the beta Microsoft Graph API

我是 Microsoft Graph API 的新手,我想用它来删除计划程序中任务详细信息的引用 (link)。

作为更新任务详细信息的一部分,我使用 externalReferenceCollection 并按照下面的 link 执行更新:http://graph.microsoft.io/en-us/docs/api-reference/beta/api/taskdetails_update

Microsoft 的文档也说:"Properties of an Open Type can be defined by the client. In this case, the client must provide valid URLs based on the HTTP/HTTPS protocols as properties and their values must be the externalReference objects. Based on OData, property names in Open Types cannot contain the following characters: ., :, % so they need to be encoded. Example is shown above. To remove a reference, set the value of the property to null"

但我不确定如何将 属性 的值设置为 null 以构建 JSON 字符串以删除任务详细信息的引用 (link)。

PS:我在 C# 中使用 HttpClient,更新任务详细信息的方式与此类似 class:https://github.com/OfficeDev/TrainingContent/blob/master/O3653/O3653-15%20Microsoft%20Graph%20for%20Planner%20and%20Tasks/Completed%20Solutions/Exercise3/Office365PlannerTask/Office365PlannerTask/Models/MyTasksRepository.cs

提前致谢!

终于,我找到了答案。我post在这里所以它应该有所帮助。

要删除带有 url 的引用,例如 "http%3A//2%2Eff%2E2%2E1",引用的请求正文 JSON 应如下所示:

{"description": "task description 1", "references": { 
"http%3A//2%2Eff%2E2%2E1": null
}}

编码愉快!