Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用TFS API获取所有优先级分类严重性值_C#_Asp.net_Tfs_Visual Studio 2013_Tfs Sdk - Fatal编程技术网

C# 使用TFS API获取所有优先级分类严重性值

C# 使用TFS API获取所有优先级分类严重性值,c#,asp.net,tfs,visual-studio-2013,tfs-sdk,C#,Asp.net,Tfs,Visual Studio 2013,Tfs Sdk,我正在使用TFSAPI构建一个Web应用程序。我想从TFS API获取所有范围的“优先级”值,并填充我的asp.net dropdownlist。同样地。我想获取“严重性”和“分类”的所有数据,并将它们填充到不同的dropdownlist中 我对下面所说的有一个印象: 以下是迄今为止我必须访问TFS项目的代码 有人能告诉我谁可以访问TFS针对优先级、严重性和分类的所有项目: Uri url = new Uri("server location"); NetworkCredential nc =

我正在使用TFSAPI构建一个Web应用程序。我想从TFS API获取所有范围的“优先级”值,并填充我的asp.net dropdownlist。同样地。我想获取“严重性”和“分类”的所有数据,并将它们填充到不同的dropdownlist中

我对下面所说的有一个印象:

以下是迄今为止我必须访问TFS项目的代码 有人能告诉我谁可以访问TFS针对优先级、严重性和分类的所有项目:

Uri url = new Uri("server location");
NetworkCredential nc = new NetworkCredential(credentials, url);
TfsTeamProjectCollection coll = new TfsTeamProjectCollection(url, nc);
coll.EnsureAuthenticated();
WorkItemStore workItemStore = coll.GetService<WorkItemStore>();
uriurl=newuri(“服务器位置”);
NetworkCredential nc=新的NetworkCredential(凭据,url);
TfsTeamProjectCollection coll=新的TfsTeamProjectCollection(url,nc);
coll.确保重新验证();
WorkItemStore WorkItemStore=coll.GetService();
类似

workItemStore.FieldDefinitions["Microsoft.VSTS.Common.Priority"].AllowedValues

应该有用。使用第一个或第二个示例取决于您想要的是所有允许的值还是仅在特定状态下允许的值;您可以设置更复杂的过滤器

用您感兴趣的其他字段替换
Microsoft.VSTS.Common.Priority
,可以找到引用名称

var filters = new FieldFilterList();
filters.Add(new FieldFilter(CoreField.State, "New"));
workItemStore.FieldDefinitions["Microsoft.VSTS.Common.Priority"].FilteredAllowedValues(filters);