所以我正在尝试更新任务并更改它所属的用户故事。这就是我想要的......
var toUpdate = new DynamicJsonObject();
// the new User Story
toUpdate["WorkProduct"] = "/hierarchicalrequirement/4567890123";
// the ObjectID of the Task
long oid = 45678912445;
OperationResult result = _restApi.Update("task", oid, toUpdate);
但是收到此错误:System.Collections.Generic.List'1[System.String]
答案 0 :(得分:0)
这是我在Kyle Morse报告的任何错误修复之前开始工作的。
public string ProxyUpdateTask(Task myTask, string strWorkProduct)
{
var message = @"<span style=""color:green;"">SUCCESS</span>";
const string errPrefix = @"<span style=""color:red;"">ERROR</span>";
var toUpdate = new DynamicJsonObject();
long oid;
Int64.TryParse(myTask.ObjectId, out oid);
toUpdate["WorkProduct"] = String.Format("/hierarchicalrequirement/{0}", myTask.UserStoryId);
try
{
var result = _restApi.Update("task", oid, toUpdate);
if (!result.Success)
message = String.Format(@" {2} updating (ObjectID={0}) failed. {1}", myTask.ObjectId, result.Errors, errPrefix);
}
catch (WebException ex)
{
message = String.Format(" {0} - {1}", errPrefix, ex.Message);
}
catch (Exception ex)
{
message = String.Format(" {0} - {1}", errPrefix, ex.Message);
}
return message;
}