如何通过rally c#api查询发布/迭代?

如何通过rally c#api查询发布/迭代?,rally,Rally,我试图查询Release和Iteration,以便用这些不同的值填写一个下拉列表。然而,我不太确定如何做到这一点。如果我们能够做到这一点,那么通过查询返回的对象的成员是什么?(名称、格式化ID、创建日期等)。我们只是创建一个类型为“Release”和“Iteration”的新请求吗 谢谢 下面是一段基于项目引用查询发布的代码。如果此项目不在运行代码的用户的默认工作区中,我们需要硬编码工作区引用或从项目中获取它 class Program { static void Main(strin

我试图查询Release和Iteration,以便用这些不同的值填写一个下拉列表。然而,我不太确定如何做到这一点。如果我们能够做到这一点,那么通过查询返回的对象的成员是什么?(名称、格式化ID、创建日期等)。我们只是创建一个类型为“Release”和“Iteration”的新请求吗


谢谢

下面是一段基于项目引用查询发布的代码。如果此项目不在运行代码的用户的默认工作区中,我们需要硬编码工作区引用或从项目中获取它

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!");
        }
    }

}
}
类程序
{
静态void Main(字符串[]参数)
{
拉莱雷斯塔皮·雷斯塔皮;
restApi=新的RallyRestApi(“user@co.com“,“TopSecret1984”https://rally1.rallydev.com", "1.40");
var projectRef=“/project/2222”//使用您的项目OID
DynamicJsonObject itemWorkspace=restApi.GetByReference(projectRef,“工作区”);
var workspaceRef=itemWorkspace[“Workspace”][“_ref”];
字典结果=新字典();
尝试
{
请求=新请求(“发布”);
request.ProjectScopeDown=false;
request.ProjectScopeUp=false;
request.Workspace=workspaceRef;
request.Fetch=newlist()
{
“姓名”
};
//request.Query=newquery(“Project.ObjectID”,Query.Operator.Equals,“2222”);//同样有效
request.Query=新查询(“Project”,Query.Operator.Equals,projectRef);
QueryResult QueryResult=restApi.Query(请求);
foreach(queryResult.Results中的var r)
{
Console.WriteLine(“名称:+r[“名称”]);
}
}
抓住
{
Console.WriteLine(“问题!”);
}
}
}
}

以下是一段代码,用于根据项目引用查询发布。如果此项目不在运行代码的用户的默认工作区中,我们需要硬编码工作区引用或从项目中获取它

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!");
        }
    }

}
}
类程序
{
静态void Main(字符串[]参数)
{
拉莱雷斯塔皮·雷斯塔皮;
restApi=新的RallyRestApi(“user@co.com“,“TopSecret1984”https://rally1.rallydev.com", "1.40");
var projectRef=“/project/2222”//使用您的项目OID
DynamicJsonObject itemWorkspace=restApi.GetByReference(projectRef,“工作区”);
var workspaceRef=itemWorkspace[“Workspace”][“_ref”];
字典结果=新字典();
尝试
{
请求=新请求(“发布”);
request.ProjectScopeDown=false;
request.ProjectScopeUp=false;
request.Workspace=workspaceRef;
request.Fetch=newlist()
{
“姓名”
};
//request.Query=newquery(“Project.ObjectID”,Query.Operator.Equals,“2222”);//同样有效
request.Query=新查询(“Project”,Query.Operator.Equals,projectRef);
QueryResult QueryResult=restApi.Query(请求);
foreach(queryResult.Results中的var r)
{
Console.WriteLine(“名称:+r[“名称”]);
}
}
抓住
{
Console.WriteLine(“问题!”);
}
}
}
}

太棒了,谢谢你的帮助。这很好地工作了,也适用于查询Iterationfantastic,谢谢这里的帮助。这很好地工作了,也适用于迭代查询