0
在这里workItemStore总是返回空.....我想要日志问题tp TFS作为nugs。但不能becoz空exception..help的,这样做是grealy赞赏...谢谢....TFS WorkItems始终返回空值
var networkCredential = new NetworkCredential(userName, password, domainName);
var credential = (ICredentials)networkCredential;
//Connect to TFS Project Collection, provide server URL in format http:// ServerName:Port/Collection
var tfs = new TfsTeamProjectCollection(
TfsTeamProjectCollection.GetFullyQualifiedUriForName(TfsConnectionUri), credential);
//Check whether valid TFS user or not
tfs.EnsureAuthenticated();
var workItemStore = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
//Iterate Through Projects
foreach (Project tfs_project in workItemStore .Projects)
{
Console.WriteLine(tfs_project.Name);
//Perform WIQL Query
WorkItemCollection wic = wis.Query(
" SELECT [System.Id], [System.WorkItemType],"+
" [System.State], [System.AssignedTo], [System.Title] "+
" FROM WorkItems " +
" WHERE [System.TeamProject] = '" + tfs_project.Name +
"' ORDER BY [System.WorkItemType], [System.Id]");
foreach (WorkItem wi in wic)
{
Console.WriteLine(wi.Title + "["+wi.Type.Name+"]"+wi.Description);
}
}
嗨,我试着上面的代码它说..“无法加载程序集Microsoft.Teamfoundation.client.dll”..我使用的DLL版本11 ... – user2155788 2013-03-26 04:55:00
是啊!这是获取WorkItemStore的方法!让我从头痛中解脱出来。非常感谢! +1 – misha 2014-01-08 13:27:12
谢谢。这种方式而不是返回null,我们得到一个Exception来知道要修复什么。非常感谢你 – 2015-08-08 04:41:50