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

心不动则不痛 提交于 2019-12-08 10:02:24

问题


I am trying to assign a user as an administrator to a project and change the owner too via rest api in Azure DevOps. 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. Any directions on this would be helpful.

Thanks!


回答1:


Assign User as an Administrator to a project once it is created using 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:

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.

You can try the Request body I posted above (Replace the to your specify project ID) and groupType is used to set different permissions:

Besides, you said you want change the owner too, do you mean change organization owner via api? If yes, I am afraid there is no such API for update the organization owner, we could only list the owner.

Hope this helps.



来源:https://stackoverflow.com/questions/55757100/assign-user-as-an-administrator-to-a-project-once-it-is-created-using-rest-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!