[英]How do I get all users in my company with a specific filter in microsoft graph API
With Microsoft Graph API, I'm trying to get all users in my company but with a specific filter such as mail = (*@company.com).. The reason I cannot just use /users is because we have many third-party and administrator (dup) accounts.使用 Microsoft Graph API,我试图获取公司中的所有用户,但使用特定的过滤器,例如 mail = (*@company.com).. 我不能只使用 /users 的原因是因为我们有很多第三方和管理员 (dup) 帐户。 I just want to retrieve the ones with a valid *@company.com email.
我只想用有效的 *@company.com email 检索那些。
I've tried a few of these, but does not work:我已经尝试了其中一些,但不起作用:
https://graph.microsoft.com/v1.0/users?$filter=mail eq '*@company.com'
https://graph.microsoft.com/v1.0/users?$filter=startswith(mail, '*@company.com')
I should also mention I am using POSTMAN to test and will implement into the Microsoft Graph SDK for PHP (msgraph-sdk-php).我还应该提到我正在使用 POSTMAN 进行测试,并将在 Microsoft Graph SDK 中实现 PHP (msgraph-sdk-php)。
Appreciate any help!感谢任何帮助!
You are trying to achieve ending of the particular string but Microsoft Graph endpoints currently don't support endsWith
or similar query parameters.您正在尝试实现特定字符串的结尾,但 Microsoft Graph 端点当前不支持
endsWith
或类似的查询参数。 From the documentation on query parameters .从有关查询参数的文档中。
Suggestion is to use PowerShell instead.建议改用 PowerShell。
Example,例子,
$Users=Get-AzureADUser -All:$true | Where-Object {$_.UserPrincipalName -clike "*onmicrosoft.com"} | Select UserPrincipalName
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.