Для получения задач
public void RetrieveWorkItems()
{
var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://TFS:8080/TFS/DefaultCollection"));
var workItemStore = tfs.GetService<WorkItemStore>();
var wiqlQuery = String.Format( @"Select [State], [Title] From WorkItems Where [Work Item Type] = 'Task' Order By [State] Asc, [Changed Date] Desc"); ;
WorkItemCollection witCollection = workItemStore.Query(wiqlQuery);
foreach (WorkItem workItem in witCollection)
{
Console.WriteLine("ID: {0}", workItem.Id);
Console.WriteLine("Title: {0}", workItem.Title);
}
}
Для ввода задачи
public void CrateTask()
{
var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://TFS:8080/TFS/DefaultCollection"));
var workItemStore = tfs.GetService<WorkItemStore>();
Project proj = workItemStore.Projects["ProjectName"];
WorkItemType type = proj.WorkItemTypes["Task"];
WorkItem workItem = new WorkItem(type);
workItem.Title = "Task entered using API";
workItem["Activity"] = "Configuration";
workItem.Save();
}