0
votes

I'm writing a WebApi to create projects in Azure Devops. The creation itself already works, but is it possible to set the team and the project manager with the Api?

I didn't find a way to do this. I already tried to add the team to the request body of the creation (https://docs.microsoft.com/en-us/rest/api/azure/devops/core/projects/create?view=azure-devops-rest-5.1) but that doesn't work.

1
Hello, is there any update for this issue? Please let me know whether my answer helps. - Jane Ma-MSFT
I'm sorry, I'm still working on it and was instructed to take care of another problem first. I'll let you know as soon as I can continue working on this issue. - Nok
It doesn't matter. Hope your problem can be solved successfully! - Jane Ma-MSFT
I think I solved the problem with the project administrator, but I don't know how to get a descriptor of the team I want to set as Project Contributors. The WebApiTeam.Identity.Descriptor.Identifier field is always null, even in the automatically created teams. I also don't know if it is even possible to use Membership - Add with a team instead of an user or a group. Do you have an idea what I can do to set a specific team as Project Contributors? - Nok
To get a descriptor of the team, you can use the REST API Teams-Get. To set a specific team as Project Contributors, you can use the REST API Members - Add. As long as the team is in the project, you can use it to add a team as a Project Contributor by replacing {memberId} with {teamId}. - Jane Ma-MSFT

1 Answers

0
votes

It is not supported for setting up teams and project administrators when a project is created, but you can do these using two REST APIs after the project is created.

Azure DevOps will set a default team when you create a project. The default team will be named "{project name} Team". To create a new team, you can use the following API:

POST https://dev.azure.com/{organization}/_apis/projects/{projectId}/teams?api-version=5.1

Click this document for detailed information.

Azure DevOps sets the person who creates the project as the first administrator. To add a new administrator, you can use the following REST API

PUT https://vssps.dev.azure.com/{organization}/_apis/graph/memberships/{subjectDescriptor}/{containerDescriptor}?api-version=5.1-preview.1

Click Memberships-Add for detailed information. You can refer to this relative question for the specific operation.