【问题标题】:SendMail with flag with a due date return ErrorInvalidArgumentError带有截止日期标志的 SendMail 返回 ErrorInvalidArgumentError
【发布时间】:2019-01-24 21:11:18
【问题描述】:

我正在尝试发送一封带有截止日期标志的电子邮件。 图资源管理器中的以下请求有效。
发布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": "vincent@baywet.onmicrosoft.com"
        }
      }
    ],
    "flag": {
      "flagStatus": "flagged"
    }
  },
  "saveToSentItems": "false"
}

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

{
  "message": {
    "subject": "Meet for lunch?",
    "body": {
      "contentType": "Text",
      "content": "The new cafeteria is open."
    },
    "toRecipients": [
      {
        "emailAddress": {
          "address": "vincent@baywet.onmicrosoft.com"
        }
      }
    ],
    "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,我的对象看起来是正确的。
documentationknown issues 中没有列出任何限制,所以 我想知道这个有效负载有什么问题,如何在发送电子邮件时设置一个带有截止日期的标志

【问题讨论】:

  • 我尝试指定首选 Outlook 时区标题,看看是否有帮助。它没有改变任何东西
  • 您能否具体说明从 Microsoft Graph 返回的响应标头,而不仅仅是响应正文?
  • client-request-id: 3f26a733-71b2-42bb-8d56-8f44d7eeb0d7 content-type: application/json cache-control: private request-id: 3f26a733-71b2-42bb-8d56-8f44d7eeb0d7跨度>

标签: microsoft-graph-api


【解决方案1】:

抱歉回复晚了。 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"
      }

我将在此更新文档。

【讨论】:

    猜你喜欢
    • 2019-10-07
    • 1970-01-01
    • 2019-04-03
    • 2018-03-21
    • 1970-01-01
    • 2018-03-25
    • 1970-01-01
    • 2023-03-24
    相关资源
    最近更新 更多