简体   繁体   English

使用rest api - Azure DevOps创建项目后,将用户指定为项目管理员

[英]Assign User as an Administrator to a project once it is created using rest api - Azure DevOps

I am trying to assign a user as an administrator to a project and change the owner too via rest api in Azure DevOps. 我正在尝试将用户指定为项目的管理员,并通过Azure DevOps中的rest api更改所有者。 Could anyone of you point me to some documentation as how it can be done? 你们中的任何人都可以向我指出一些文件是如何完成的吗? I have looked at UserEntitlements API and Project API - but I haven't figured how I can use them for my issue. 我查看了UserEntitlements API和Project API - 但我还没想到如何将它们用于我的问题。 Any directions on this would be helpful. 任何指示都会有所帮助。

Thanks! 谢谢!

Assign User as an Administrator to a project once it is created using rest api - Azure DevOps 使用rest api - Azure DevOps创建项目后,将用户指定为项目管理员

Just as you know in your previous post, we could also use the API User Entitlements - Update User Entitlement to assign a user as an administrator to a project: 正如您在上一篇文章中所知,我们还可以使用API 用户权利 - 更新用户权利来将用户指定为项目的管理员:

The Request body as following: 请求正文如下:

[
  {"from":"",
    "op":0,
      "path":"/projectEntitlements",
        "value":{"projectRef":{"id":"<MyProjectID>"},"group":{"groupType":3}}

  }
]

Then I could add a user to a specific project (I am using postman): 然后我可以将用户添加到特定项目(我使用邮递员):

在此输入图像描述

As result, the status is 200 OK and the use is added to the project. 结果,状态为200 OK,并将使用添加到项目中。

You can try the Request body I posted above (Replace the to your specify project ID) and groupType is used to set different permissions: 您可以尝试我上面发布的请求主体(替换为您指定的项目ID),groupType用于设置不同的权限:

在此输入图像描述

Besides, you said you want change the owner too, do you mean change organization owner via api? 此外,你说你想要改变所有者,你的意思是通过api改变组织所有者吗? If yes, I am afraid there is no such API for update the organization owner, we could only list the owner. 如果是,我担心没有这样的API来更新组织所有者,我们只能列出所有者。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure DevOps 使用 REST API 调用 GetItem - Azure DevOps calling GetItem using REST API 如何使用 powershell(Azure devops REST API)获取用户提交更改的 Azure devops git repo 文件夹名称 - How to get Azure devops git repo folder name where user committed changes using powershell (Azure devops REST API) 在PowerShell中使用Azure DevOps REST API更新内部版本定义 - Update build definition using Azure DevOps REST API in PowerShell 使用 Rest API 在 Azure Devops 中创建工作项时出错 - Error while creating Work Item in Azure Devops using Rest API 使用 Powershell 的 Azure Devops 审计 rest api 延续令牌 - Azure Devops audit rest api continuation token using powershell Azure devops rest api 结果使用 powershell 脚本循环 - Azure devops rest api result looping using powershell script 使用 REST API Azure devops 传递变量组名称 - Pass a Variable group name using REST API Azure devops 如何使用 Azure DevOps REST API 设置发布定义工件 - How to set Release Definition artifacts using Azure DevOps REST API 如何使用 Devops REST API 搜索带有 Powershell 的 Azure Devops 代码存储库并输出到 CSV - How to search Azure Devops Code Repos w/ Powershell using Devops REST API and output to CSV 如何使用 PowerShell 从 Azure CloudShell 访问 Azure DevOps REST API? - How to access Azure DevOps REST API from Azure CloudShell using PowerShell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM