microsoft-graph-api - 带有带有截止日期标志的 SendMail 返回 ErrorInvalidArgumentError

标签 microsoft-graph-api

我正在尝试发送一封带有截止日期标记的电子邮件。 图形浏览器中的以下请求有效。
发布https://graph.microsoft.com/v1.0/me/sendMail

{
  "message": {
    "subject": "Meet for lunch?",
    "body": {
      "contentType": "Text",
      "content": "The new cafeteria is open."
    },
    "toRecipients": [
      {
        "emailAddress": {
          "address": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9ceaf5f2fff9f2e8dcfefde5ebf9e8b2f3f2f1f5ffeef3eff3fae8b2fff3f1" rel="noreferrer noopener nofollow">[email protected]</a>"
        }
      }
    ],
    "flag": {
      "flagStatus": "flagged"
    }
  },
  "saveToSentItems": "false"
}

具有以下负载的相同请求失败

{
  "message": {
    "subject": "Meet for lunch?",
    "body": {
      "contentType": "Text",
      "content": "The new cafeteria is open."
    },
    "toRecipients": [
      {
        "emailAddress": {
          "address": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6f1906010c0a011b2f0d0e16180a1b41000102060c1d001c00091b410c0002" rel="noreferrer noopener nofollow">[email protected]</a>"
        }
      }
    ],
    "flag": {
      "flagStatus": "flagged",
      "dueDateTime": {
        "timeZone": "Pacific Standard Time",
        "dateTime": "2019-01-25T19:58:27"
      }
    }
  },
  "saveToSentItems": "false"
}

出现以下错误消息

{
    "error": {
        "code": "ErrorInvalidArgument",
        "message": "The request is invalid.",
        "innerError": {
            "request-id": "5e335c05-071b-4b23-8511-006db9e6e883",
            "date": "2019-01-24T20:03:45"
        }
    }
}

请注意,唯一的区别是以下节点(截止日期)

"dueDateTime": {
        "timeZone": "Pacific Standard Time",
        "dateTime": "2019-01-25T19:58:27"
      }

根据documentation ,我应该传入一个 DateTimeTimeZone 对象,即使这篇特定文章没有示例,根据 similar examples 我的对象看起来也是正确的。 .
documentation 中未列出任何限制。以及known issues所以我想知道这个有效负载有什么问题,以及如何在发送电子邮件时设置带有截止日期的标志

最佳答案

抱歉回复晚了。 9个月后,我终于得到了空气,可以和工程师一起深入研究。查看后端逻辑。必须设置开始日期和截止日期才能使其发挥作用。

所以你需要这样做

  "flag": {
      "flagStatus": "flagged",
      "dueDateTime": {
        "timeZone": "Pacific Standard Time",
        "dateTime": "2019-12-25T19:58:27"
      },
      "startDateTime": {
        "timeZone": "Pacific Standard Time",
        "dateTime": "2019-11-25T19:58:27"
      }

我将更新相关文档。

关于microsoft-graph-api - 带有带有截止日期标志的 SendMail 返回 ErrorInvalidArgumentError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54355346/

相关文章:

api - Microsoft Graph API 创建事件始终使用 UTC 时区创建 session

microsoft-graph-api - 图生命周期通知未注册正确的端点

c# - 为什么 Graph API 无法正确提供 AAD 用户上次事件

reactjs - Azure B2C 引发访问 token 验证失败。无效观众

azure - 为什么使用 Office 365 应用程序注册工具创建的应用程序在 Azure 管理门户中不可见?

office365 - 由于字符无效,无法反序列化来自 Graph API 的错误响应

azure - 将/groups/{id}/members 上的 $filter 查询参数与 Azure B2C 租户的 Graph API 结合使用

node.js - 为什么我对新访问 token 的请求没有返回新的刷新 token ?

office365 -/workingWith 联系人列表在 Office 365 Graph API 中更新的频率如何?

microsoft-graph-api - Microsoft Graph HonorNonIndexedQueriesWarningMayFailRandomly 过滤 SharePoint Online 列表时出错