问题
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
, andnot
.
来源:https://stackoverflow.com/questions/49197733/how-to-combine-not-filter-in-ms-graph-api