azure - 通过 Microsoft Graph 检索用户列表时不支持查询

标签 azure azure-ad-graph-api

我想检索在某个特定日期之前通过 Microsoft Graph Explorer 创建的特定用户的列表

我正在关注此 Microsoft 文档:List users - Microsoft Graph v1.0 | Microsoft Docs形成查询。

我尝试像下面这样查询:

GET
https://graph.microsoft.com/v1.0/users?$select=createdDateTime, displayName, id, mail&$filter=createdDateTime le 2021-07-14

但是我收到如下错误:

{
"error": {
"code": "Request_UnsupportedQuery",
"message": "Unsupported or invalid query filter clause specified for property 'createdDateTime' of resource 'User'.",
"innerError": {
"date": "2022-05-12T14:24:38",
"request-id": "5378dd7c-7413-4b97-9399-09a6f4f11c50",
"client-request-id": "ba9f70f4-f33c-c753-fb3a-c6f1a197ef46"
}}}

我已授予 Microsoft 文档中提到的所需权限。我认为我的查询有问题。

有人可以帮我解决这个问题吗?

最佳答案

出现错误的原因是,您仅使用日期进行过滤。

要解决该错误,您必须包含时间以及日期,如下所示:

GET https://graph.microsoft.com/v1.0/users?$select=createdDateTime, displayName, id, mail&$filter=createdDateTime le 2021-04-06T08:03:07Z&$count=true

我在我的环境中进行了尝试并通过上述查询成功获取了用户列表:

enter image description here

确保包含以下格式的时间戳:

createdDateTime ge yyyy-MM-ddTHH:mm:ssZ

欲了解更多详情,请引用以下链接:

Azure graph API for users doesn't support filter by createdDateTime anymore - Microsoft Q&A

关于azure - 通过 Microsoft Graph 检索用户列表时不支持查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72219313/

相关文章:

azure - 如何检索允许用户从 AzureAD Graph API 访问哪些应用程序/servicePrincipal?

asp.net-mvc - 无法从 global.asax 检索 Azure 图形 token

azure - 使用图形 api 对 Azure AD 中的 guest 用户进行身份验证

azure - 如何通过 Azure PowerShell 授予用户对第三方企业应用程序的同意?

azure - 需要在 Powershell 中设置 ARR 关联性和 HTTP 版本方面的帮助

asp.net - 系统.IO.FileLoadException : Loading this assembly would produce a different grant set from other instances

sql-server - MSSQL PaaS 实例的 Azure 完整 ARM 部署失败

从 API 调用 Microsoft Graph 时 Azure AD B2C 重置密码选项

使用 JWT token 进行 Azure AD 身份验证

java - 如何使用 Java 从 Azure AD 导入用户