当在图形API上使用filter时,如何只返回字段属性不是blankcurrenty的数据?https://graph.microsoft.com/beta/users?$filter=EmployeeId ge '!'
但这些似乎并不是正确的方法......这样做 EmployeeId ne ''
似乎是不允许的。这个字段在没有填写的时候是空白而不是空的,至少在我的租户中是这样。
...
"displayName": "Test Example",
"employeeId": "000Blah",
...
有谁能确认这是否是正确的方式?
基本上只想返回那些有填写employeeId的记录。
目前在graph中没有过滤功能,在用户端点上做空(或空)过滤。我相信有请求所有在互联网上要求微软实现它,然而,就目前而言,没有正确的方法来做它。
这里是一个用户的声音请求 https:/microsoftgraph.uservoice.comforums920506-microsoft-graph-feature-requestssuggestions36040288-useful-user-endpoint-filtering。 你可以投赞成票
在这种情况下 $filter
不支持 -ne
但根据我的测试,它支持 -eq
意思是说,你可以得到没有填写的用户。employeeId
(只是一个小建议,不知道有没有用)。
注意事项 你应该知道空洞的数量。employeeId
意思是 (hit the space bar once) is different from
(按两次空格键)。
我的变通方法是使用powershell来做,确保你有 安装了 AzureAD
模块 并使用 Connect-AzureAD
来登录。
使用下面的命令,你可以得到填写了以下内容的用户。employeeId
. 在我的样本中,我只用了一个空白。
Get-AzureADUser -All $true | Where-Object {$_.ExtensionProperty.employeeId -ne ' '}