我正在使用.NET client libraries之类的Microsoft.TeamFoundationServer.Client来检索Azure DevOps中的工作项。
但是,尽管Azure DevOps Services REST API documentation中提到了它,但我找不到通过.NET客户端库获取选择列表信息的方法(请参见下图)
是否可以通过.NET客户端库(例如通过Microsoft.TeamFoundationServer.Client)检索选择列表信息?
答案 0 :(得分:1)
string _personalAccessToken = "xxxxxx";
VssBasicCredential credentials = new VssBasicCredential("", _personalAccessToken);
var connection = new VssConnection(new Uri(@"https://dev.azure.com/xxx"), credentials);
WorkItemTrackingProcessHttpClient client = connection.GetClient<WorkItemTrackingProcessHttpClient>();
Console.Write("Getting list of processes....");
List<ProcessInfo> list = client.GetListOfProcessesAsync().Result;
if (list == null || list.Count == 0)
{
Console.WriteLine("No processes found");
}
else
{
Console.WriteLine("Done");
foreach (var item in list)
{
Console.WriteLine("{0} {1} {2}", item.Name, item.TypeId, item.ReferenceName);
}
}