Azure DevOps Api to add a user or group as a admin for a team

后端 未结 1 1078
无人及你
无人及你 2020-12-12 05:35

I am trying to use the API to add a user (or another group) as an admin for a team.

I am able to use the api to create a team, create groups, create areas & ite

相关标签:
1条回答
  • 2020-12-12 06:14

    To add member of current Organization to Project Administrator you should use:

    Memberships - Add: PUT (application/json)

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

    1.subjectDescriptor: A descriptor to a group or user that can be the child subject in the relationship.

    2.containerDescriptor: A descriptor to a group that can be the container in the relationship.

    Note:

    Values of subjectDescriptor and containerDescriptor are hard to get, so I'm not sure if it meets your requirements in your specific scenario.

    We have to fetch the subjectDescriptor (represent user) and containerDescriptor (represent ProjectAdmin of one project) before you use Memberships-Add api. For me:

    I use Users-List to list all the details about Users in Collection to get the Descriptor of one user:

    And use Groups-List to list all the groups to get the Descriptor of Project Admin of one project:

    Then use MemberShips-Add to add the user to project RequireCheck's Project Administrator group. Once we get the 201-created, we can see the change in web portal after refreshing the page. (Sometimes it has one minute delay.)

    Update: Another direction you can check this ticket.

    0 讨论(0)
提交回复
热议问题