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

问题描述

我正在尝试从 Microsoft Graph API 获取按收件人筛选的消息列表.我用于请求的网址是:

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

但我得到的回应是:

{错误": {"code": "ErrorInvalidUrlQueryFilter","message": "查询过滤器包含一个或多个无效节点.",内部错误":{请求 ID":7db712c3-e337-49d9-aa8d-4a5d350d8480",日期":2016-09-28T16:58:34"}}}

一个成功的请求应该是这样的(我省略了更多的数据).

{"@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",价值": [{收件人":[{电子邮件地址": {"名称": "[名称]",地址":[电子邮件地址]"}}],}]}

如果我删除过滤器,请求就会起作用,并且我可以使用更简单的过滤器执行请求.

我的网址有问题,还是有其他方法可以提出请求?

解决方案

找了几个小时后,在office365文档中发现 toRecipients 属性不可过滤:

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

我猜它在图形 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]')

But I am getting this is the response:

{
   "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?

解决方案

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

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

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

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

08-12 04:27