使用ExtendedProperty和Office 365 REST API筛选多个可能的值 [英] Filtering multiple possible values with ExtendedProperties and Office 365 REST API

查看:126
本文介绍了使用ExtendedProperty和Office 365 REST API筛选多个可能的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于它们的 InternetMessageID .

对于一个给定的InternetMessageID,我可以按照提供的语法

For one given InternetMessageID, I can retrieve the corresponding mail following the syntax provided in Outlook documentation

 "https://outlook.office365.com/api/beta/me/messages?$filter=SingleValueExtendedProperties/any(ep:  ep/PropertyId eq 'String 0x1035' and ep/Value eq '<12.FF.36768.EE3E3365@twitter.com>' )";

现在让我们说,我想以相同的请求检索两封邮件,但我没有设法获得成功的语法.

Now let us say that I want to retrieve two mails with the same request I did not manage to get a successful syntax.

例如

 "https://outlook.office365.com/api/beta/me/messages?$filter=SingleValueExtendedProperties/any(ep:  ep/PropertyId eq 'String 0x1035' and (ep/Value eq '<12.FF.36768.EE3E3365@twitter.com>' or ep/value eq 'anothermailid@toto.com'))";

不起作用.返回 BadRequest 并显示一条消息

does not work. A BadRequest is returned with a message

The filter expression for $filter does not match to a single extended property and a value restriction.

我已经尝试了多种分组组合,并且还按照

I have tried many combination of grouping and also test with an $expand statement as suggested in this question. Is there a way to perform such kind of requests with Outlook Web Api of Graph API ?

推荐答案

我也尝试过此方法,但得到的消息更多:

I just tried this as well, and I get a more informative error message:

{
  "error": {
    "code": "ErrorInvalidUrlQueryFilter",
    "message": "The filter expression for $filter on property ExtendedProperty only allows 
               [and] and [eq] operators. The equality can only be specified between 
               'PropertyId' and a constant or 'Value' and a constant (for example: 
               PropertyId eq 'value')."
  }
}

更新:已与我的工程团队核对,并且此错误涉及ANY语句中的内容.您不能在其中使用OR.因此,要使这项工作有效,您需要两个单独的ANY语句,并用OR进行连接:

UPDATE: Checked with my engineering team, and this error refers to what is inside the ANY statement. You can't use OR in there. So to make this work, you need two separate ANY statements joined by an OR:

https://outlook.office.com/api/beta/me/messages?$filter=
  SingleValueExtendedProperties/any(ep: ep/PropertyId eq 'String 0x1035' 
                                    and ep/Value eq 'someid@somedomain') or 
  SingleValueExtendedProperties/any(ep: ep/PropertyId eq 'String 0x1035' 
                                    and ep/Value eq 'otherid@otherdomain')

这篇关于使用ExtendedProperty和Office 365 REST API筛选多个可能的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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