When using the Azure DevOps Connector in Microsoft flow to query the ADO api users. It only returns 500 users. How can I get it to return the all of the users?
I think I need it to pass back in the continuationToken in the header and return the next page of results. but it doesnt give no default way of doing this.
Does anyone know how to get the full set of results back? It only returns a subset.
Thanks
Hi @Anonymous / @InnComing
Yes. You can intialize an integer variable and add the number of users in the org to the value of this variable. Now, add a do until action and then set it to run until this variable value is less than 0.
Intialize another variable to store the continuation string and then check if that string is empty then do send a request without that and once the request is sent, set the variable to that string. when the string has value, send the request with the string to get the next set of users and after this again add the set variable action to set the new continuation string. Remember to add an increment variable action after every http request and select the first variable you initialized and for the increment value type in -500 (as you have confirmed that it returns 500 users. you can also use the length function to check the number of users returned from the previous action and subtract that from the primary variable)
The loop will run until the number of users are returned as specified in the variable.
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
we have like over 10,000 users. I don't want to run the http action 10 times. Do you know how to do a while loop in power automate? e.g.
while continuation != 'null' keep returning users until it returns all users.
many thanks!!
Hi @InnComing
As per the API documentation, the list users also returns a continuation string that can be passed further in another http action to get the next set of users: https://docs.microsoft.com/en-us/rest/api/azure/devops/graph/users/list?view=azure-devops-rest-5.1
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!