通过 Graph API 从 Microsoft Planner 任务中检索附件附件、任务、API、Graph

2023-09-06 17:40:14 作者:烟寂℡

我目前使用 Microsoft Graph 与 Planner 进行交互,并且我正在尝试设置一个程序,以便能够完全读取有关组、计划、存储桶和任务的所有数据.

I currently using Microsoft Graph to interface with PLanner and I am attempting to set up a program to be able to fully read in all data about Groups, Plans, Buckets and the Tasks.

API 功能强大,到目前为止我可以阅读所有内容(甚至是每个单独的评论),但就我的一生而言,我似乎无法找到阅读任务附件的方法!

The API has a lot of power and so far I can read in everything (even each individual comment) but for the life of me, I can't seem to find a way to read in attachments of a task!

API 文档似乎也没有表明任务和附件之间存在任何关系,这意味着在 Planner 上,甚至不应该有附件.

The API documentation doesn't seem to indicate that there is any relationship between tasks and attachments either, implying that on Planner, there shouldn't even be an attachment.

Planner 任务对象文档:https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/plannertask

Planner Task Object Documentation: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/plannertask

API 的壁橱是在评论部分发布附件.(参见:https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/post)但无论我如何使用它,它都不会在计划器上读取任务本身的附件因为 List Attachments 函数只是为每个帖子返回空值.(因为在 Planner 本身上,附件是附加到任务中的,而不是单个帖子)

The closet the API has is Post attachments, in the comments section. (See this: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/post) but no matter hwo i use that, it won't read in attachments to the task itself on planner as that List Attachments function simply returns empty for every post. (Because on Planner itself, the attachment is attached to the task, not an individual post)

事实上,获取附件文档详细说明了获取附件的不同方式(请参阅:https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/attachment_get) 显示您可以获得它来自日历事件、帖子或事件.但不是像 Planner 允许的任务!

In fact, the Get Attachment documentation details the different ways you can get attachments (see: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/attachment_get) showing you can get it from calendar events, posts or events. But not tasks, like Planner allows!

文档中是否缺少某些内容,或者这只是 API 不允许的内容?我也找不到其他人在网上谈论它.

Is there something I am missing from the documentation or is this just something the API doesn't allow yet? I also can't really find anyone else talking about it online.

推荐答案

Planner 附件只是指向外部资源的链接,存储在 任务详情 任务对象.关于任务详情,external references collection 包含任务的所有引用的 URL,可用于访问适当的资源.

Planner attachments are just links to external resources, stored on the task details object of the task. On the task details, external references collection contains the URL of all the references of the task, which can be used to access the proper resource.