microsoft-graph-api - 稍后发送电子邮件

标签 microsoft-graph-api

我想知道 /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/

相关文章:

c# - 使用 Microsoft Graph 在 Planner 中为当前用户获取所有计划

azure-active-directory - 如何限制/限制Azure应用程序注册API权限

ios - 在 iOS 中更改用户密码时,MSGraphSDK 用户详细信息 API 回调未响应

spring-security - Spring Security 中 Microsoft Graph OAuth2 身份验证的配置 - 错误 AADSTS90014

microsoft-graph-api - 使用 Microsoft Graph SDK 1.4 NuGet 的增量查询

azure - SAML2.0认证后调用Graph api。如何获取所需的身份验证 token

botframework - 使用 OAuthPrompt 获取 Microsoft Graph API 的刷新 token

c# - 在 Microsoft Graph 客户端库中应用访问 token

sharepoint - 微软图形API : how to get access token without browser

c# - 找不到方法 : 'System.Threading.Tasks.Task` 1&lt;! !0>