查询特定用户的电子邮件

时间:2019-07-30 15:42:58

标签: microsoft-graph microsoft-graph-mail

我们的目标是在特定的接收日期时间内获取特定用户的电子邮件,并仅列出以下邮件属性:

从,到收件人,cc收件人,密件抄送收件人

这是我们运行的查询

https://graph.microsoft.com/v1.0/users/user1@contoso.com/messages$select=from,toRecipients,ccRecipients,bccRecipients$filter=ReceivedDateTime ge 2019-07-01 and receivedDate lt 2019-07-02

https://graph.microsoft.com/v1.0/users/user1@contoso.com/messages$select=from,toRecipients,ccRecipients,bccRecipients$filter=ReceivedDateTime ge 2019-07-01 and receivedDate lt 2019-07-02

错误:

{
    "error": {
        "code": "ErrorFolderNotFound",
        "message": "The specified folder could not be found in the store.",
        "innerError": {
            "request-id": "8b58633d-3e7f-4e25-a6bc-bd1562340bc4",
            "date": "2019-07-30T15:11:12"
        }
    }
}

1 个答案:

答案 0 :(得分:0)

您的查询链接中有几个错误:

  1. 由于$select$filter属性是URL查询字符串的一部分,因此必须在它们之前加上?
  2. $filter是与$select不同的参数,因此必须用&分隔
  3. 选定/过滤的属性必须与API提供的属性完全匹配,包括大小写(您编写了“ ReceivedDateTime”和“ receivedDate”,两者都应为“ receivedDateTime”

这是更正的URL: https://graph.microsoft.com/v1.0/users/user1@contoso.com/messages?$select=from,toRecipients,ccRecipients,bccRecipients&$filter=receivedDateTime ge 2019-07-01 and receivedDateTime lt 2019-07-02

有关所有可用邮件属性的列表,请参见documentation