无法按Microsoft Graph Api中的收件人筛选邮件.一个或多个无效节点 [英] Unable to filter messages by recipient in Microsoft Graph Api. One or more invalid nodes

查看:144
本文介绍了无法按Microsoft Graph Api中的收件人筛选邮件.一个或多个无效节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Microsoft Graph API获取按收件人过滤的邮件列表.我用于请求的网址是:

I am trying to get a list of messages that are filtered by recipient from Microsoft Graph API. The url I am using for the request is:

https://graph.microsoft.com/beta/me/messages?$filter=toRecipients/any(r: r/emailAddress/address eq '[Email Address]')

但是我得到的是响应:

{
   "error": {
        "code": "ErrorInvalidUrlQueryFilter",
        "message": "The query filter contains one or more invalid nodes.",
        "innerError": {
            "request-id": "7db712c3-e337-49d9-aa8d-4a5d350d8480",
            "date": "2016-09-28T16:58:34"
        }
    }
}

一个成功的请求应该看起来像这样(我遗漏了很多数据).

A successful request should look like this (with a lot more data that I have omitted).

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#users('99999999-9999-9999-9999-999999999999')/messages",
    "@odata.nextLink": "https://graph.microsoft.com/beta/me/messages?$skip=10",
    "value": [
        {
            "toRecipients": [
                {
                    "emailAddress": {
                        "name": "[Name]",
                        "address": "[Email Address]"
                    }
                }
            ],
        }
    ]
}

如果删除过滤器,该请求将起作用,并且能够使用更简单的过滤器执行请求.

The request works if I remove the filter, and I am able to perform requests with simpler filters.

我的网址是否有问题,或者还有另一种发出请求的方式吗?

Is there a problem with my URL, or is there another way to make the request?

推荐答案

寻找解决方案几个小时后,我在office365文档中发现toRecipients的属性不可过滤:

After several hours looking for the solution, I found in the office365 documentation that property toRecipients is not filterable:

https ://msdn.microsoft.com/zh-cn/office/office365/api/complex-types-for-mail-contacts-calendar#MessageResource

我猜它在图形API中是相同的,所以唯一的解决方案是使用搜索

I guess that it's the same in the graph api, so only solution is using search

这篇关于无法按Microsoft Graph Api中的收件人筛选邮件.一个或多个无效节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆