1

我正在尝试同时查询 Release 和 Iteration,以便可以使用这些不同的值填写下拉列表。但是,我不太确定如何执行此操作。如果我们能够做到这一点,通过查询返回的对象成员是什么?(名称、FormattedID、CreationDate 等)。我们只是创建一个“发布”和“迭代”类型的新请求吗?

谢谢!

4

1 回答 1

1

这是一个基于项目参考查询发布的代码。如果此项目不在运行代码的用户的默认工作区中,我们要么需要对工作区引用进行硬编码,要么从项目中获取它。

class Program
{

    static void Main(string[] args)

    {
        RallyRestApi restApi;
        restApi = new RallyRestApi("user@co.com", "TopSecret1984", "https://rally1.rallydev.com", "1.40");
        var projectRef = "/project/22222222"; //use your project OID
        DynamicJsonObject itemWorkspace = restApi.GetByReference(projectRef, "Workspace");
        var workspaceRef = itemWorkspace["Workspace"]["_ref"];

        Dictionary<string, string> result = new Dictionary<string, string>();
       try
        {

            Request request = new Request("Release");
            request.ProjectScopeDown = false;
            request.ProjectScopeUp = false;
            request.Workspace = workspaceRef;
            request.Fetch = new List<string>()
             {
                 "Name"

             };
          // request.Query = new Query("Project.ObjectID", Query.Operator.Equals, "22222222"); //also works
            request.Query = new Query("Project", Query.Operator.Equals, projectRef);
            QueryResult queryResult = restApi.Query(request);
            foreach (var r in queryResult.Results)
            {
                Console.WriteLine("Name: " + r["Name"]);
            }

       }
        catch
        {
            Console.WriteLine("problem!");
        }
    }

}
}
于 2013-06-14T21:38:12.993 回答