How can I update Rally team membership?

依然范特西╮ 提交于 2019-12-11 10:48:34

问题


I'm stumped on how to update team membership through the API. I'm able to add users to projects, through project permissions, but can't update the team membership to show that a user is part of a specific team. How is that best accomplished?


回答1:


The TeamMemberships collection on User is modifiable. Since the question was tagged with C# here is an example of how to do this (assumes wsapi v2.0 and .net rest toolkit 2.0):

//Get the current team memberships for a user
var user = restApi.GetByReference("/user/12345", "TeamMemberships");
Request teamMemberRequest = new Request(user["TeamMemberships"]);
List<DynamicJsonObject> teams = new List<DynamicJsonObject>(restApi.Query(teamMemberRequest).Results.Cast<DynamicJsonObject>());

//Add the new team (project)        
DynamicJsonObject newTeam = new DynamicJsonObject();
newTeam["_ref"] = "/project/23456";
teams.Add(newTeam);

//Update the user
DynamicJsonObject toUpdate = new DynamicJsonObject();
toUpdate["TeamMemberships"] = teams;
restApi.Update(user["_ref"], toUpdate);


来源:https://stackoverflow.com/questions/18993417/how-can-i-update-rally-team-membership

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