I would like to know if there are any cli commands or rest api's to get the list of users in an Azure DevOps project. For example, In an organization if there are two projects "alpha" and "beta" with 10 users in each project. I able to get all the list of 20 users by cli or rest api's. But, how can I only get the list of users in "alpha" project?
Agree with Sajeetharan
We can use the API with the variable scopeDescriptor to get the list of user in one project.
Steps:
List all projects and get the "alpha" project ID.
GET https://dev.azure.com/{organization}/_apis/projects?api-version=6.0
Get the one project scopeDescriptor via Descriptors - Get
GET https://vssps.dev.azure.com/{organization}/_apis/graph/descriptors/{storageKey}?api-version=5.0-preview.1

Note: we need enter the "alpha" project ID to the field storageKey and then Copy the value of value to the scopeDescriptor field of the API shared below.
GET https://vssps.dev.azure.com/{organization}/_apis/graph/users?scopeDescriptor={scopeDescriptor}&api-version=6.0-preview.1
Then we could only get the list of users in "alpha" project.
Have you had a look at the Azure Devops REST API
you just need to set the scope with the project name.
GET https://vssps.dev.azure.com/{organization}/_apis/graph/users?subjectTypes={subjectTypes}&continuationToken={continuationToken}&scopeDescriptor={scopeDescriptor}&api-version=6.0-preview.1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With