question

Samuel-5040 avatar image
0 Votes"
Samuel-5040 asked ZehuiYaoMSFT-7151 commented

List all users in large group

I need to iterate over all the users in a large group (>700,000 users). A certain subset of my users created before a specific date are either missing properties that are now required or have some properties set incorrectly. I'm attempting to do this via REST calls out of a script I've written.

Running through the /groups/{id}/members API call I can confirm that Graph returns an invalid skipToken at around 700,000 users, which matches up with the graph connector API item limit shown here:

201922-image.png

And here's the response when I use the skipToken from the request that was successful:

 {
     "error": {
         "code": "Request_UnsupportedQuery",
         "message": "Unable to execute query; invalid page token specified.",
         "innerError": {
             "date": "2022-05-13T18:52:00",
             "request-id": "{id}",
             "client-request-id": "{id}"
         }
     }
 }


I have tried filtering the users by createdDateTime le {yyyy-mm-ddT00:00:00Z} but it looks like Graph doesn't support that property for filtering:

 {
     "error": {
         "code": "Request_UnsupportedQuery",
         "message": "The specified filter to the reference property query is currently not supported.",
         "innerError": {
             "date": "2022-05-13T18:49:16",
             "request-id": "{id}",
             "client-request-id": "{id}"
         }
     }
 }

I also know that some of the users I need to update don't have a specific property set, but it doesn't look like Graph supports filtering by a missing property either.

So, how can I get my invalid users from Azure?

TLDR: I'm running a script that makes REST calls to the Azure Graph API. I have users, created before a specific date, that are missing or have some invalid properties I need to update.


microsoft-graph-users
image.png (21.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ZehuiYaoMSFT-7151 avatar image
0 Votes"
ZehuiYaoMSFT-7151 answered ZehuiYaoMSFT-7151 commented

Hello @Samuel-5040, per my test Indeed the /members endpoint does not support filter for filtering

So far, one solution I can offer is to filter by https://graph.microsoft.com/v1.0/users?$select=id,displayName,createdDateTime&$filter= createdDateTime le yyyy-mm-ddT00:00:00Z for createdDateTime.

Then use https://graph.microsoft.com/v1.0/users/7ecaa4ca-93a1-4208-b94f-da6c6882f7d6/memberof to determine whether the filtered users belong to your group.

Finally get the users you want, hope this helps you



If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @Samuel-5040, did the above answer help you? If you have any questions, please comment here.

0 Votes 0 ·