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

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

问题描述

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

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

有没有人能够使用 API 做到这一点?

解决方案

要将当前组织的成员添加到项目管理员,您应该使用:

并使用

然后使用MemberShips-Add将用户添加到项目RequireCheck的项目管理员组.一旦我们获得了 201-created,我们可以在刷新页面后看到门户网站的变化.(有时会延迟一分钟.)

更新:您可以查看这张票的另一个方向.

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 & iterations however I can seem to add a user as an admin for the team.

Has anyone been able to do this using the API?

解决方案

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.

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

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