我想知道 /v1.0/me/sendMail
是否有延迟发送电子邮件的功能。在 Outlook 客户端中,您可以指定希望在以后的日期和时间发送电子邮件。我四处窥探,看看是否有可以在消息对象上设置的属性来指示这一点。
有没有人找到让这个工作的方法?当然,我可以在我的软件中实现一些东西来处理延迟发送,但如果它已经存在,为什么还要重新创建一些东西。
最佳答案
您可以使用扩展属性实现电子邮件的延迟发送。这些可以使用“singleValueExtendedProperties”属性在图形 API 请求负载上设置。
要使用的属性是 PidTagDeferredSendTime其 ID 为 0x3FEF,类型为 SystemTime。
id attribute of "singleValueExtendedProperties"根据您设置的属性采用不同的格式。
对于延迟发送时间,您可以使用 SystemTime 0x3FEF
。
使用 HTTP JSON POST 负载的示例:
{
"message": {
"subject": "Meet for lunch?",
"body": {
"contentType": "Text",
"content": "The new cafeteria is open."
},
"toRecipients": [
{
"emailAddress": {
"address": "bob@contoso.com"
}
}
],
"singleValueExtendedProperties":
[
{
"id":"SystemTime 0x3FEF",
"value":"2019-01-29T20:00:00"
}
]
}
}
使用 Microsoft Graph API 客户端库的示例:
var client = /* Create and configure GraphServiceClient */;
var msg = new Message();
msg.ToRecipients = List<Recipient>();
msg.ToRecipients.Add(new Recipient() {
EmailAddress = new EmailAddress() { Address ="bob@contoso.com" }
};
msg.Subject = "Meet for lunch?";
msg.Body = new ItemBody()
{
Content = "The new cafeteria is open.",
ContentType = BodyType.Text,
};
msg.SingleValueExtendedProperties = new MessageSingleValueExtendedPropertiesCollectionPage();
msg.SingleValueExtendedProperties.Add(new SingleValueLegacyExtendedProperty()
{
Id = "SystemTime 0x3FEF",
Value = DateTime.UtcNow.AddMinutes(5).ToString("o")
});
await client.Me.SendMail(msg, true).Request().PostAsync();
关于microsoft-graph-api - 稍后发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48696033/