First, we need to recognize the two classes of TFS two-time acquisition objects.
They are tfsconfigurationserver and tfsteamprojectcollection, and their difference is that they can get different TFS API service classes. Their differences are as follows:
Basically, we can operate all the function points on TFS through the above two classes. Let's take a look at how to use tfsteamprojectcollection to get all the items under a specific team collection and print out the project name.
Remove the
project name under the Team collection Uri and, if the team collection is empty, take the default set item
//uri Tfsuri = new Uri ("Http://pc-20130113jkun:8080/tfs/Calueng"); This will calueng the
team set under the project
uri Tfsuri = new Uri ("Http://pc-20130113jkun:8080/tfs");
Tfsteamprojectcollection Server = new Tfsteamprojectcollection (Tfsuri);
WorkItemStore workstore = server. Getservice<workitemstore> ();
foreach (Project project in Workstore. Projects)
{
Console.WriteLine ("Defaultcollection Collection) The project name is:" + project. Name);
Console.WriteLine ("---------------------------------------------------------------");