我正在尝试发送一封带有截止日期标记的电子邮件。
图形浏览器中的以下请求有效。
发布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/