如何更新拉力赛团队成员资格? [英] How can I update Rally team membership?

查看:36
本文介绍了如何更新拉力赛团队成员资格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对如何通过 API 更新团队成员感到困惑.我可以通过项目权限将用户添加到项目中,但无法更新团队成员身份以显示用户是特定团队的一部分.这是如何最好地完成的?

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?

推荐答案

User 上的 TeamMemberships 集合是可修改的.由于问题是用 C# 标记的,这里是如何执行此操作的示例(假设 wsapi v2.0 和 .net rest toolkit 2.0):

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);

这篇关于如何更新拉力赛团队成员资格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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