如何在 MS Graph API 中结合 NOT 过滤器 [英] How to combine NOT filter in MS Graph API

查看:35
本文介绍了如何在 MS Graph API 中结合 NOT 过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为每个名字以某种价值开头的人搜索图形 API 用户

I want to search graph API users for everyone whos name does not start with some value

我试过了

https://graph.microsoft.com/v1.0/users?$filter="NOT startswith(displayName,'J')"
https://graph.microsoft.com/v1.0/users?$filter=not(startswith(displayName,'J'))

但是我明白了

无效的过滤器子句

有什么办法可以做到这一点吗?

Is there any way to achieve this?

我实际上需要在 C# 中执行此操作,在那里我遇到了同样的问题 - 我想知道是否有一种使用 SDK 指定 NOT STARTSWITH 的方法?

I actually need to do this in C#, where I run into the same issue - I wonder if there is a way of specifying NOT STARTSWITH using the SDK?

string filter = String.Format("startswith(displayName,'J')");
List<QueryOption> options = new List<QueryOption>
{
    new QueryOption("$filter", filter)
};
var users = await graphClient.Users
    .Request(options)
    .Top(500)
    .GetAsync();

推荐答案

恐怕用户(或任何其他 Azure AD 资源)不支持这种类型的过滤器.来自文档:

I'm afraid this type of filter is not supported by users (or any other Azure AD resources). From the documentation:

Azure AD 资源不支持以下 $filter 运算符:negtgeltlenot.

The following $filter operators are not supported for Azure AD resources: ne, gt, ge, lt, le, and not.

这篇关于如何在 MS Graph API 中结合 NOT 过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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