Azure DevOps Api将用户或组添加为团队的管理员 [英] Azure DevOps Api to add a user or group as a admin for a team

查看:520
本文介绍了Azure DevOps Api将用户或组添加为团队的管理员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用API​​将用户(或另一个组)添加为团队的管理员.

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

我能够使用api创建团队,创建群组,创建区域和迭代,但是我似乎可以将用户添加为团队的管理员.

I am able to use the api to create a team, create groups, create areas & iterations however I can seem to add a user as an admin for the team.

有人可以使用API​​来做到这一点吗?

Has anyone been able to do this using the API?

推荐答案

要将当前组织的成员添加到Project Administrator,您应该使用:

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:组或用户的描述符,可以是关系中的子主题.

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

2. containerDescriptor:组的描述符,该组可以是关系中的容器.

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

注意:

很难获得subjectDescriptorcontainerDescriptor的值,因此我不确定在特定情况下它是否满足您的要求.

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

由于Memberships-Add api是唯一将成员添加到Project Administrator的API,因此在使用Memberships-Add之前,必须先获取subjectDescriptor(代表用户)和containerDescriptor(代表一个项目的ProjectAdmin). api.对我来说:

Since the Memberships-Add api is the only one to add member to Project Administrator, you 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:

然后使用MemberShips-Add将用户添加到项目RequireCheck的项目管理员"组中.创建201后,刷新页面后即可看到Web门户中的更改. (有时会有一分钟的延迟〜)

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 ~)

这篇关于Azure DevOps Api将用户或组添加为团队的管理员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆