How to combine NOT filter in MS Graph API

ⅰ亾dé卋堺 提交于 2021-02-10 18:01:30

问题


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

I tried

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

But I get

Invalid filter clause

Is there any way to achieve this?


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();

回答1:


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

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



来源:https://stackoverflow.com/questions/49197733/how-to-combine-not-filter-in-ms-graph-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!