问题
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