Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When using filter on the graph API, how to do you only return data where a field isn't blank

When using filter on the graph API, how to do you only return data where a field / property isn't blank currenty doing https://graph.microsoft.com/beta/users?$filter=EmployeeId ge '!' but these doesn't seem the correct way to do this... doing EmployeeId ne '' isn't allowed it seems. This field is blank not null when not filled in, atleast in my tenant anyway.

...
"displayName": "Test Example",
"employeeId": "000Blah",
...

Any one able to confirm if this is the correct way?

Basicly only want to return the records where people do have their employeeId filled in.

like image 580
FingerlessGloves Avatar asked Oct 22 '25 18:10

FingerlessGloves


2 Answers

This should do the job

https://graph.microsoft.com/beta/users?$filter=userType eq 'Member' and employeeId ge ' ' 

Please notice the space.

like image 110
Raymond A. Avatar answered Oct 25 '25 16:10

Raymond A.


There currently is no filter capability in graph on the users endpoint to do null(or empty) filtering. I believe there are requests all over the internet asking microsoft to implement it, however as it stands, there is no correct way to do it. your work around seems as good as any.

Here is a user voice request for it https://microsoftgraph.uservoice.com/forums/920506-microsoft-graph-feature-requests/suggestions/36040288-useful-user-endpoint-filtering you can vote for it

like image 26
alphaz18 Avatar answered Oct 25 '25 17:10

alphaz18