在Rally C#API中添加标记(到userStory或Task)

在Rally C#API中添加标记(到userStory或Task),c#,rally,C#,Rally,我正在努力使用语法在Rally REST API中使用标记更新或创建任务 这是我的密码: //Tag Holder ArrayList tagArray = new ArrayList(); tagArray.Add(tag._ref); //the Task itself DynamicJsonObject toCreate = new DynamicJsonObject(); toCreate["WorkProduct"] = storyRef; //i need to pass t

我正在努力使用语法在Rally REST API中使用标记更新或创建任务

这是我的密码:

//Tag Holder
ArrayList tagArray = new ArrayList();
tagArray.Add(tag._ref);

//the Task itself
DynamicJsonObject toCreate = new DynamicJsonObject();
toCreate["WorkProduct"] = storyRef;

  //i need to pass the tags as a parameter
   NameValueCollection parameters = new NameValueCollection();
  //this is where I am stuck, how do I attach the tags to the parameters

 //call the API to create the task
 CreateResult resultX = api.Create("task", toCreate, parameters );

非常感谢你的帮助

收集有点棘手-你非常接近。数组中的每个条目都需要是具有_ref属性的对象,而不仅仅是ref

DynamicJsonObject tagObj = new DynamicJsonObject();
tagObj["_ref"] = tag._ref;
tagArray.Add(tagObj);

感谢@Kyle Morse为我提供了这个问题的答案,为了其他需要这样做的人的完整性,下面是我在Rally API中创建带有标记的任务的代码

//task object
DynamicJsonObject toCreate = new DynamicJsonObject();    
toCreate["WorkProduct"] = storyRef;

//Tag Holder
ArrayList tagArray = new ArrayList();

//loop through your tags
foreach(tag in tags)
{
     DynamicJsonObject tagObj = new DynamicJsonObject();
     tagObj["_ref"] = tag._ref;
     tagArray.Add(tagObj);
}

//this is where you attach the tags
toCreate["Tags"] = tagArray;  

//call the API to create the task
CreateResult result = api.Create(WorkSpace._ref,"task", toCreate );

谢谢,凯尔,这让我发疯了!这对于创建任务非常有效,但是当我尝试在更新操作中添加标记时,它会说我未经授权(没有标记也可以正常工作)。下面是我的答案,除了调用update而不是create之外,我使用的代码是相同的。您使用的是最新的工具包版本(3.2.1)?我们刚刚发现的一个时间缺陷可能在这里起作用。恢复到3.0.1版是我们目前推荐的解决方案。。。也许值得一试?