本文介绍了TFS工作项目的回报总是空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面workItemStore始终返回null .....我想登陆TP TFS问题作为猪兔。但不能becoz空exception..help的这么做是grealy AP preciated ......谢谢你......
VAR的NetworkCredential =新的NetworkCredential(用户名,密码,域名);VAR凭证=(ICredentials)的NetworkCredential;//连接到TFS项目集合,提供服务器的URL格式http://服务器:端口/收藏VAR TFS =新TfsTeamProjectCollection(TfsTeamProjectCollection.GetFullyQualifiedUriForName(TfsConnectionUri),证书);//检查是否有效TFS用户或不tfs.EnsureAuthenticated();VAR workItemStore =(WorkItemStore)tfs.GetService(typeof运算(WorkItemStore));//迭代通过项目 的foreach(在workItemStore .Projects项目tfs_project) { Console.WriteLine(tfs_project.Name); //执行WIQL查询 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(WIC中的无线网络连接工作项) { Console.WriteLine(wi.Title +[+ wi.Type.Name +]+ wi.Description); } }解决方案
尝试这种方式来创建WorkItemStore
TfsTeamProjectCollection TFS =新TfsTeamProjectCollection(新的URI(TfsServerURI),NC);VAR _wis =新WorkItemStore(TFS);Here workItemStore always returns null.....i want log issues tp TFS as a nugs. But not able to do so becoz of null exception..help is grealy appreciated...Thank you....
var networkCredential = new NetworkCredential(userName, password, domainName); var credential = (ICredentials)networkCredential; //Connect to TFS Project Collection, provide server URL in format 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); } }解决方案
Try it this way to create the WorkItemStore
TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri(TfsServerURI), nc); var _wis = new WorkItemStore(tfs);
更多推荐
TFS工作项目的回报总是空
发布评论