4

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?

2 Answers 2

7

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

enter image description here

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.

Sign up to request clarification or add additional context in comments.

Comments

2

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

2 Comments

It's also important to remember about proper permissions assigned to your service account which will reach API.
pay attention, Graph work only on Azure DevOps Service, not on Azure DevOps Server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.