Microsoft graph api 以后再发送电子邮件
我想知道Microsoft graph api 以后再发送电子邮件,microsoft-graph-api,Microsoft Graph Api,我想知道/v1.0/me/sendMail是否能够延迟发送电子邮件。在Outlook客户端中,您可以指定希望在以后的日期和时间发送电子邮件。我四处窥探,看看是否有一个属性可以在message对象上设置来指示这一点 有人找到办法让它工作了吗?当然,我可以在我的软件中实现一些东西来处理延迟的发送,但是如果它已经存在,为什么还要重新创建一些东西呢。 您可以在创建项目时设置延迟发送时间延长属性。您可以使用扩展属性实现电子邮件的延迟发送。可以使用“singleValueExtendedProperties
/v1.0/me/sendMail
是否能够延迟发送电子邮件。在Outlook客户端中,您可以指定希望在以后的日期和时间发送电子邮件。我四处窥探,看看是否有一个属性可以在message对象上设置来指示这一点
有人找到办法让它工作了吗?当然,我可以在我的软件中实现一些东西来处理延迟的发送,但是如果它已经存在,为什么还要重新创建一些东西呢。
您可以在创建项目时设置延迟发送时间延长属性。您可以使用扩展属性实现电子邮件的延迟发送。可以使用“singleValueExtendedProperties”属性在Graph API请求负载上设置这些属性 要使用的属性是ID为0x3FEF且类型为SystemTime的 根据所设置的属性,将采用不同的格式 对于延迟发送时间,您将使用
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"
}
]
}
}
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客户端库的示例:
{
"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"
}
]
}
}
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();
var-client=/*创建和配置GraphServiceClient*/;
var msg=新消息();
msg.ToRecipients=List();
msg.ToRecipients.Add(新收件人(){
EmailAddress=新的EmailAddress(){Address=“bob@contoso.com" }
};
msg.Subject=“一起吃午饭?”;
msg.Body=newitembody()
{
Content=“新自助餐厅已开放。”,
ContentType=BodyType.Text,
};
msg.SingleValueExtendedProperties=新消息SingleValueExtendedPropertiesCollectionPage();
msg.SingleValueExtendedProperties.Add(新的SingleValueLegacyExtendedProperty()
{
Id=“SystemTime 0x3FEF”,
Value=DateTime.UtcNow.AddMinutes(5).ToString(“o”)
});
等待client.Me.SendMail(msg,true.Request().PostAsync();
我从那篇文章中可以看到,我的电子邮件是以JSON数据的形式发送的。我想我看到了设置扩展属性的方法。看起来属性id是:16367,日期时间的类型是:[Microsoft.Exchange.WebServices.data.MapPropertyType]::SystemTime将看到可以实现的功能:)下面是向邮件消息添加扩展属性的JSON。只需要找出正确的id和延迟发送的值。“singleValueExtendedProperties”:[{“id”:“String{66f5a359-4659-4830-9070-00047ec6ac6e}名称颜色”,“值”:“绿色”}]我想到的最好的方法是:“singleValueExtendedProperties”:[{“id”:“String{8ECCC264-6880-4EBE-992F-8888D2EEAA1D}名称PidAgederRedSendTime”,“值”:“2018-02-10T00:28:20”}]这似乎不起作用。有人知道这是否可以通过发送到graph.microsoft.com的JSON完成吗?这是一个prop标记,因此不使用命名空间guid。请尝试Id:“Integer 0x3FEF”