Here is a quick script which demonstrates how to connect to TFS and get projects. Make sure you add reference to necessary dlls - Microsoft.TeamFoundation.Client and Microsoft.TeamFoundation.WorkItemTracking.Client

Imports Microsoft.TeamFoundation.Client
Imports Microsoft.TeamFoundation.WorkItemTracking.Client
Imports System.Net
 
Public Class Form1
    Dim nc As NetworkCredential = New NetworkCredential("user", "pass")
    Dim tfsurl As New Uri("http://192.168.0.2:8080")
    Dim tfs As TeamFoundationServer
    Dim wis As WorkItemStore
 
    Private Sub Form1_Load(ByVal sender As System.Object, 
	ByVal e As System.EventArgs) Handles MyBase.Load
        tfs = New TeamFoundationServer(tfsurl.AbsoluteUri, nc)
    End Sub
 
    Private Sub Button1_Click(ByVal sender As System.Object, 
	ByVal e As System.EventArgs) Handles Button1.Click
        tfs.Authenticate()
 
        wis = tfs.GetService(GetType(WorkItemStore))
        For Each proj As Project In wis.Projects
            If (proj.HasWorkItemReadRights) Then
                ListBox1.Items.Add(proj.Name)
            End If
        Next
    End Sub
End Class
VN:F [1.1.6_502]
Rating: 0.0/5 (0 votes cast)
Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • DotNetKicks
  • LinkedIn
  • Live
  • MySpace
  • StumbleUpon
  • Technorati

Related posts:

  1. Simple WPF ViewModel implementaion with VisualBasic.NET
  2. Connect using UDL file from .NET
  3. WinForms – Print using printDialog and printDocument
  4. c# Listbox – change color of items
  5. Find your lucky number in c#