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