Filtering objects by date in MS Graph

我的未来我决定 提交于 2020-02-25 04:20:08

问题


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

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

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-08-02T13:01:13Z

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'


回答1:


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/en-us/graph/delta-query-overview



来源:https://stackoverflow.com/questions/54182538/filtering-objects-by-date-in-ms-graph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!