使用 ExtendedProperties 和 Office 365 REST 过滤多个可能的值 API
Filtering multiple possible values with ExtendedProperties and Office 365 REST API
我正在尝试根据 InternetMessageID 获取电子邮件列表。
对于给定的 InternetMessageID,我可以按照提供的语法检索相应的邮件 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>' )";
现在让我们说我想用相同的请求检索两封邮件,但我没有设法获得成功的语法。
例如
"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 返回消息
The filter expression for $filter does not match to a single extended property and a value restriction.
我尝试了多种分组组合,并且还按照 中的建议使用 $expand
语句进行了测试。有没有办法用 Graph API 的 Outlook Web Api 执行此类请求?
我也试过了,我收到了一条信息更丰富的错误消息:
{
"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 连接:
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')
我正在尝试根据 InternetMessageID 获取电子邮件列表。
对于给定的 InternetMessageID,我可以按照提供的语法检索相应的邮件 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>' )";
现在让我们说我想用相同的请求检索两封邮件,但我没有设法获得成功的语法。
例如
"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 返回消息
The filter expression for $filter does not match to a single extended property and a value restriction.
我尝试了多种分组组合,并且还按照 $expand
语句进行了测试。有没有办法用 Graph API 的 Outlook Web Api 执行此类请求?
我也试过了,我收到了一条信息更丰富的错误消息:
{
"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 连接:
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')