获取 Rally 任务所有者名称的正确方法是什么? [英] What is the proper way to fetch the Owner Name of a Rally Task?

查看:33
本文介绍了获取 Rally 任务所有者名称的正确方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 RallyRestToolkitFor.NET 并将信息从 Rally 任务提取到我们的后台系统.除了我无法获取任务的所有者"的名称外,一切都运行良好.

I'm using the RallyRestToolkitFor.NET and I'm pulling information from Rally tasks into our back office system. It is all working well except I'm having trouble fetching the name of the "Owner" of the task.

事实上,我似乎无法从所有者那里获取任何信息.下面是一个代码片段,所以你可以看到我在做什么.它适用于 Description 和 FormattedID,但在 QueryResult 中返回的所有者名称在 Rally 中实际设置时为空.

In fact, I can't seem to pull any information from the Owner. Below is a code snippet so you can see what I'm doing. It works great for the Description and FormattedID but the Owner name returned in the QueryResult is blank when it's actually set in Rally.

我尝试了所有者"、用户"、用户名",但没有任何效果.我想我只是对如何检索任务的所有者名称感到困惑.但是,我可以很好地查询 Owner.Name,但我无法在列表中获取它.有没有人有任何想法?

I've tried "Owner", "User", "User.Name", and nothing has worked. I guess I'm just stumped on how to retrieve the Owner Name on a task. However, I can query on Owner.Name just fine, but I'm not able to fetch it in the list. Does anyone have any ideas?

Request request = new Request("task");

request.Fetch = new List<string>() {"Owner.Name", "Description", "FormattedID" };

request.Query = new Query("Project.Name", Query.Operator.Equals, "My Project"); 

QueryResult queryResult = restApi.Query(request);

foreach (var result in queryResult.Results)

{

ownerName = result["Owner.Name"];

}

推荐答案

您可以只提取 Owner,然后在同一个提取中包含来自 User 对象类型的各个字段:

You can just fetch Owner and then also include individual fields from the User object type right in the same fetch:

request.Fetch = new List<string>() {"Owner", "UserName", "DisplayName" };

然后在响应中:

owner = result["Owner"]
if(owner != null) 
{
    ownerName = owner["UserName"]
}

同样的概念应该适用于 WSAPI 中的任何子对象子类型.

This same concept should work for any child object sub types in WSAPI.

这篇关于获取 Rally 任务所有者名称的正确方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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