Accessing Team Information using Team Foundation 11 SDK

Written against Visual Studio/Team Foundation beta; so subject to any changes in the SDK.

Team Foundation Server 11 has the notion of teams; and its possible to assign work and iterations to multiple teams within a single Team Project.

I was searching for  a way to access the Team information via the Microsoft.TeamFoundation.Client  API and stumbled over the TfsTeamService class.

Add a reference to Microsoft.TeamFoundation.Client.dll.

Note: The tfs assemblies can be found either in the GAC or under the folder  %programfiles%\Microsoft Visual Studio 11.0\Common7\IDE

Create a connection to TFS project collection:

Uri collectionUri = new Uri(@"http://<server>:8080/tfs/<tpcName>");                         TfsTeamProjectCollection tfsConnection=                new TfsTeamProjectCollection(collectionUri, new UICredentialsProvider());

Create an instance of the TfsTeamService class and call the Initialize method passing in the connection

    TfsTeamService teamService = new TfsTeamService();     teamService.Initialize(tfsConnection);

You now must query the Team Information by calling a method on the TfsTeamService instance. There are 3 possible methods to use:

//The project URI - this is the identifier for the Team Project you're looking within. 
//To retrieve the project URI you need to iterate the team projects - see TFS 2010 on MSDN 
 string projectUri  
          = @"vstfs:///Classification/TeamProject/7356cf03-278b-4b04-8915-eb50d29665ca"; 

//1. Returns the default team in the Team Project
TeamFoundationTeam defaultTeam = teamService.GetDefaultTeam( 
                projectUri,  
                new List<String>() 
                );     

//2. Returns a specific team in the Team Project based on the teamname parameter provided
TeamFoundationTeam specificTeam = teamService.ReadTeam( 
                projectUri, 
                "TeamName", 
                new List<String>() 
                );  

//3. Returns all the teams in the Team Project
IEnumerable<TeamFoundationTeam> allTeams = teamService.QueryTeams(projectUri);

.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, “Courier New”, courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

 

Now that you have the Team Information you can access it properties as expected. For example to console output a list of members in a team you can use:

TeamFoundationIdentity[] teamMembers=   team.GetMembers(tfsConnection, MembershipQuery.Expanded);                         foreach (var member in teamMembers) {                   Console.WriteLine("  {0}", member.DisplayName);     foreach (var item in member.GetProperties())     {          Console.WriteLine("       {0}: {1}", item.Key, item.Value);                       }             
}

72 Replies to “Accessing Team Information using Team Foundation 11 SDK”

  1. Surprise this kind of guide is definitely outstanding it truly helped me and even my family, thanks a lot!

  2. Wow, Indeed an interesting contribution – I adore your knowledge on the said subject and have bookmarked your contribution for future reference Thank You! good luck.

  3. Bravo! Great contribution its a marvellous piece of work! keep the high job up I have also bookmarked your site. Thank you for sharing

  4. Hi there! This article couldn't be written any better! Looking at this post reminds me of my previous roommate! He constantly kept preaching about this. I most certainly will forward this article to him. Pretty sure he will have a great read. Thanks for sharing! Look into my blog post car shipping companies ( visit the up coming internet site – http://presetpond.com/uncategorized/international-automobile-shipping-service/ )

  5. I have cultured a few of the essence effects by your post. I'd personally too like to mention that near can ensue position where you will achieve request for a lend and never hardship a cosigner such as a Government Student Aid Lend. Except proviso you are getting that lend from end to end a common advance service at that moment you need to live primed to have a co-signer ready to compose it easier for you. The lenders can base a few evaluation by the few factors nevertheless the biggest will be real your credit rating. Near are some credit companies that will furthermore glance at your work times past and choose based on that but in approximately every one hand baggage it will axis by your credit make.

  6. Sorry for the huge review, but I'm really loving the new Zune, and hope this, as well as the excellent reviews some other people have written, will help you decide if it's the right choice for you.

  7. Scroll down for videoThe inside of the 'pod' reveals luxurious seating for five people which can be rearranged to make a living from farming alone. Federal agent's investigations allege that between July 2006 and March 2012, http://www.citywideadz.comhttp://www.citywideadz.com/profiles/blogs/compared-helpful-answers-for-wise-secrets Crundwell stole $30, 236, 503 from Dixon through the RSCDA account. When seen on the road. motorhome insurance – http://brain-ex.com/user/view/profile/login/federicou cheap motorhome insurance – http://suitepage.com/blogs/1546/16928/further-guidance-on-smart-secret website – http://login.myrecruitingsolutions.com/members/erwinjarr/ campervan insurance – http://novvice.com/en/blog/31987/33792http://novvice.com/en/blog/31987/33792 , cheap motorhome insurance; betterbadminton.com – http://betterbadminton.com/profile/BernardHolloman , webpage – http://techbog.com/business/a-background-on-primary-criteria-in/

  8. I was supposed to pickup my wife from a friend's house. Another thing to ascertain is if they cleaned after themselves and completed the job on time. They must maintain certain sales levels and provide material safety data sheets to the customer. my webpage; Plumbing Companies Paterson NJ – http://www.youtube.com/watch?v=YJyO8s0QljI

  9. There are many out there who do work with people who have a good income and good credit. You should as well have local retail stores where you can apply for a payday loan, $15 to $30 finance charges per $100 loaned. These are actually short term loans with high interest repayments. The study says that the burden of maintaining a timeshare you no longer use or need. The interest rate on the major amount can be extended and how many attempts a lender can make to recover payments from a borrower's bank account. Take a look at my blog – Sms LåN ( Webs.Com – http://smslan-nu.webs.com )

  10. Definitely imagine that that you stated. Your favorite reason seemed to be on the web the easiest thing to take into account of. I say to you, I definitely get irked even as other people think about concerns that they just do not realize about. You managed to hit the nail upon the top as well as outlined out the entire thing with no need side-effects , people could take a signal. Will probably be back to get more. Thank you Here is my blog – flyer designing – http://Www.5Cubecommerce.com/flyer-design.html

  11. I additionally believe that mesothelioma is a uncommon form of melanoma that is generally found in those previously exposed to asbestos. Cancerous cells form while in the mesothelium, which is a shielding lining which covers most of the body's internal organs. These cells typically form inside lining of the lungs, tummy, or the sac that encircles one's heart. Thanks for discussing your ideas.

  12. Its such as you learn my thoughts! You appear to understand so much approximately this, like you wrote the guide in it or something. I feel that you simply can do with some % to power the message home a bit, however instead of that, this is excellent blog. A fantastic read. I will definitely be back. Also visit my homepage: ??? ??? ?? – http://cherishsisters.com/vs4npr.html

  13. The Numbers Helpline has sourced 1000's of customer service contact <a href="http://www.numbershelpline.co.uk/sky-customer-service-contact-telephone-number-uk/&quot;>Phone numbers</a> in the UK. We know how hard it can be to find those <a href="http://www.numbershelpline.co.uk/dvla-contact-phone-number/&quot;>Phonenumbers</a> at times that why we have made a directory with them all in one place so you will never have waste long periods of time looking for a customer service contact <a href="http://www.numbershelpline.co.uk/easyjet-customer-service-contact-phone-number/&quot;>Phonenumbers</a> again.

  14. Admiring the hard work you put into your website and detailed information you present. It's great to come across a blog every once in a while that isn't the same unwanted rehashed information. Excellent read! I've bookmarked your site and I'm adding your RSS feeds to my Google account.

  15. Sometimes I just think that people write and don't really have much to say. Not so here. You definitely have something to say and you say it with style, my man! You sure do have an interesting way of drawing people in, what with your videos and your words. You've got quite a one-two punch for a blog!

  16. I still possess a few questions although appealing website, i read it. Shoot me an email and more becasue I might have a fascinating strategy for you personally will be talked by us.

  17. I have been exploring for a write-up such as this. Ultimately discovered it… Really good although required time read cheers. It’s been not easy to obtain the information I needed. I use this website to get a whole lot.

  18. You're a writer that is very powerful. I will notice this inside your guide. You have of producing engaging data that initiates awareness that is much an easy method.

  19. Add mobile phone and SMS function to your iPod Touch (iTouch) with this magic protection case, support iPod Touch 1st, 2nd or 3rd generation with Jailbreak.

  20. you have nice blog can you allow me to share your post to mfb fanpage here > fb.com/viralberg or viralberg,, if you dont mind i can linkback to you

Leave a Reply to Pakistani Audio Video Chat room Cancel reply

Your email address will not be published. Required fields are marked *