本文介绍了在MS Graph中按日期过滤对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取在特定日期之后创建的所有用户的列表.

I'm trying to get a list of all users who were created after a certain date.

我可以使用下面的端点来获取所有用户,然后再次将其扩展以请求用户创建日期.在图资源管理器中,这仅显示我的日期,其余为空白,但我猜这取决于权限,因此我不担心,因为它将在具有请求的图权限的SPFx Web部件中运行

I can use the endpoint below to get all users and then extend it again to request the user created date. In the graph explorer this only shows my date the rest are blank but I'm guessing this is down to permissions so I'm not concerned as this will be running in an SPFx web part with requested Graph permissions

https://graph.microsoft.com/v1.0/users

https://graph.microsoft.com/v1.0/users ?$ select = id,displayName,jobTitle,createdDateTime

https://graph.microsoft.com/v1.0/users?$select=id, displayName, jobTitle, createdDateTime

无论我输入任何过滤器,请参见下面的示例,我从不会收到任何错误消息'createdDateTime gt 2018-08-02T13:01:13Z'中位置26的语法错误"的任何响应

Regardless of any filter I enter, see examples below, I never get any response on an error saying "Syntax error at position 26 in 'createdDateTime gt 2018-08-02T13:01:13Z'"

https://graph.microsoft.com/v1.0/users ?$ select = id,displayName,jobTitle,createdDateTime& $ filter = createdDateTime gt 2018-01-01

https://graph.microsoft.com/v1.0/users?$select=id, displayName, jobTitle, createdDateTime&$filter= createdDateTime gt 2018-01-01

https://graph.microsoft.com/v1.0/users ?$ select = id,displayName,jobTitle,createdDateTime& $ filter = createdDateTime gt 2018-08-02T13:01:13Z

https://graph.microsoft.com/v1.0/users?$select=id, displayName, jobTitle, createdDateTime&$filter= createdDateTime gt 2018-08-02T13:01:13Z

我希望能够找到在某个日期之后创建的所有用户,但是无法在此日期属性上过滤用户结果,它仅适用于displayName eq'Raymond Little'之类的基本详细信息

I want to be able to find all users created after a certain date but can't filter the user results on this date property it only works with basic details like displayName eq 'Raymond Little'

推荐答案

不幸的是,此资源类型当前不支持按createdDateTime进行过滤.我们计划在将来添加它,但目前尚不能共享ETA.

Unfortunately, filtering by createdDateTime is not currently supported on this resource type. We plan to add it in the future, but cannot share an ETA, yet.

您将必须获取完整的用户集合并在本地过滤掉.

You would have to fetch the full user collection and filter out locally.

如果您的方案是寻找已创建的净新用户,请考虑使用增量查询功能.它使您可以有效地拾取新创建的资源.

If your scenario is about finding net new users that have been created, consider using the delta query capability. It allows you to efficiently pick up newly created resources.

https://docs.microsoft.com/zh-CN /graph/delta-query-overview

这篇关于在MS Graph中按日期过滤对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 00:55