【问题标题】:Getting Status of new Email send via MS GraphAPI通过 MS Graph API 获取新电子邮件发送的状态
【发布时间】:2019-02-21 21:45:58
【问题描述】:

我正在使用 msgraph api,我可以发送消息等,但我希望能够检查新创建消息的状态。发送新消息时返回的并不多,实际上正文是空白的,下面是状态码和标头

Success - Status Code 202
client-request-id: 067e8a6e-ca66-450c-bef3-55b61f72a6bb
content-type: text/plain
cache-control: private
request-id: 067e8a6e-ca66-450c-bef3-55b61f72a6bb

是否有一个 api 调用,您可以在其中获取有关请求状态的信息?因为 request-id 不是发送消息头或推送通知的一部分。

还有一个 API 调用可以让我获取用户被授权发送的所有电子邮件地址,以避免此类响应

{
    "error": {
        "code": "ErrorSendAsDenied",
        "message": "The user account which was used to submit this request does not have the right to send mail on behalf of the specified sending account., Cannot submit message.",
        "innerError": {
            "request-id": "50c4d68b-f23b-4f1f-8202-e95220e45628",
            "date": "2019-02-21T21:43:57"
        }
    }
}

【问题讨论】:

    标签: microsoft-graph-api microsoft-graph-mail


    【解决方案1】:

    不幸的是,这个 api 没有返回 Location 标头,其中包含指向状态资源的链接以供您监控。但是,您可以通过轮询您发送的电子邮件的“已发送邮件”文件夹来确定邮件是否已成功发送。

    GET https://graph.microsoft.com/v1.0/me/mailfolders/{sent-folder-id}/messages?$filter("subject eq '<sent email subject>'")
    

    您可以从对此的响应中确定 `sent-folder-id':

     GET https://graph.microsoft.com/v1.0/me/mailfolders
    

    【讨论】:

    • 我想,但我想我问。从 api 获取用户发送的用户的列表是否有任何运气,以防止错误endasdenied?
    猜你喜欢
    • 1970-01-01
    • 2020-05-30
    • 2018-11-14
    • 1970-01-01
    • 1970-01-01
    • 2016-05-11
    • 1970-01-01
    • 1970-01-01
    • 2021-04-18
    相关资源
    最近更新 更多