简体   繁体   English

如何使用 microsoft graph API 中的特定过滤器获取公司中的所有用户

[英]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.

相关问题 如何向 Microsoft Graph Api 发布 GET 请求? - How do I post a GET Request to Microsoft Graph Api? 如何使用Facebook PHP图形API获取用户图片? - How do I get the users picture using the Facebook PHP graph API? 如何使用新的microsoft graph api创建身份验证令牌? - How do I create an auth token with the new microsoft graph api? Microsoft Graph API:使用 PHP 获取组中用户的任务 - Microsoft Graph API : Get Tasks of users in a group with PHP 如何使用Graph API资源管理器或FQL查看特定人员的所有墙上帖子? - How do I use Graph API explorer or FQL to see all my wall posts from a particular person? 如何使用新的 microsoft graph api 将用户登录到 yii 站点 - How to use new microsoft graph api to log users in to yii site 如何使用 facebook graph api 获取某个用户最近喜欢的所有帖子? - How do I get all the posts that a certain user has liked recently with facebook graph api? 如何使用PHP API客户端检索公司的Google日历资源? - How do I retrieve Google Calendar Resources for my company using the PHP API client? Facebook Graph API,如何获取用户电子邮件? - Facebook Graph API, how to get users email? 如何让我的用户以特定格式插入日期? - How do I let my users insert a date in a specific format?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM