【问题标题】:Merge queries using Microsoft Graph API使用 Microsoft Graph API 合并查询
【发布时间】:2021-06-12 02:51:49
【问题描述】:

我是 Microsoft Graph API 的新手。我们的应用程序的要求是根据预期的主题收集最新的电子邮件,并收集电子邮件的附件(CSV格式)。

当使用下面的查询但使用 2 个 GET 请求时,这已经可以正常工作了:

首先是用于收集最新的电子邮件:

https://graph.microsoft.com/v1.0/me/messages?$select=id,hasAttachments&$top=1&$filter=subjecteq '{subject}'

第二个是通过传递第一个查询返回的id来收集附件:

https://graph.microsoft.com/v1.0/me/messages/{id}/attachments

问题:有没有办法将这个请求合并为一个以使代码更好?

谢谢!

【问题讨论】:

    标签: https microsoft-graph-api


    【解决方案1】:

    据我目前所知,没有办法合并这两个请求。正如您所指出的,邮件 ID 是列出附件所必需的。

    【讨论】:

      【解决方案2】:

      更新:我能够将两个请求与 $expand 参数的用户合并:

      https://graph.microsoft.com/v1.0/me/messages?$select=id,hasAttachments&$top=1&$filter=subjecteq '{subject}'&$expand=attachments

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-11-10
        • 1970-01-01
        • 2021-12-06
        • 2018-11-10
        • 1970-01-01
        • 1970-01-01
        • 2019-10-29
        • 2019-01-10
        相关资源
        最近更新 更多