Managing Your TFS Preview Tasks Inside SharePoint With Infragistics Grid Web Part

Have you heard of the Azure-based Team Foundation Services? No? Well, it is new service, provided by Microsoft for increased productivity. Although the service is pre-release at this time and is not complete, much of the TFS functionality works today.  You can use:

  • Source control
  • Work item tracking
  • Testing
  • Agile project management (a new feature in TFS 11, you can read more about it at Brian Harry’s blog)

You can explore more at

With this sort of introduction, now let’s show you the items which we will be retrieving. In the screenshot below, you can see the work items for our imaginary project.


Showing the Tasks Inside SharePoint

Using SharePoint ECT you have various options for using the TFS Preview data. For example, we could associate a task with one of our documents in a document library.


Also, you can just view the tasks inside the Infragistics Grid web part.


Building the BDC Model

We can retrieve this information by entirely using SharePoint Business Connectivity Services.


  • For greater security, we will be retrieving the login credentials from Secure Store Services. Please note that they are not available for SharePoint Foundation, i.e. the free version of SharePoint. However, if you have Microsoft Search Services Express, you automatically get Secure Store Services in your Foundation.
  • Visual Studio 2010. For the purpose of this blog, we are using VS 2012 RC.
  • Windows Live Account associated with TFS Preview.

Steps for Building the BDC

1. Fire up Visual Studio and create a new SharePoint project. It must be of type FARM solution since we are going to create a BDC model.


2. Add a new item of type Business Connectivity Model – this step is not required if you are using VS2010.


3. Add the following references

  • Microsoft.BusinessData.dll
  • Microsoft.Office.SecureStoreService.dll
  • Microsoft.Office.Server.dll
  • Microsoft.TeamFoundation.Client.dll
  • Microsoft.TeamFoundation.dll
  • Microsoft.TeamFoundation.WorkItemTracking.Client.dll


The first three are located in the GAC folder (C:\Windows\assembly\GAC_MSIL\…).

The rest are coming with TFS tools, which are integrated with VS2012 RC. For VS2010, you will need to install TFS Tools.

4. Model the BDC model.

Open your BDC schema and model at least the specific finder and finder methods (Read Item and Read List respectively).



5. Open your Entity class and describe your in-memory data object. In our case, we are just interested in the following properties.


6. Write the business logic for Read Item and Read List Methods

Add your read item and read list business logic.


7. OK but what about Azure TFS connection?

As we already said, we have setup a Secure Store Application inside our Secure Store Services in SharePoint.

It has two parameters – user name and password, which represent our Live ID and Live ID password.


8. Now return to your service class, where you have described the Specific Finder and Finder methods’ logic.

Add a constructor and add the connection logic.

   1:  ISecureStoreProvider secureStoreProvider = SecureStoreProviderFactory.Create();
   3:              // Look for a Secure Store Application with ID LiveIDSecureStore
   4:              using (SecureStoreCredentialCollection credentials = secureStoreProvider.GetCredentials("LiveIDSecureStore"))
   5:              {
   6:                  foreach (SecureStoreCredential credential in credentials)
   7:                  {
   8:                      switch (credential.CredentialType)
   9:                      {
  10:                          case SecureStoreCredentialType.WindowsUserName: UserName = Convert.ToString(credential.Credential);
  11:                              break;
  13:                          case SecureStoreCredentialType.WindowsPassword: Password = Convert.ToString(credential.Credential);
  14:                              break;
  15:                      }
  16:                  }
  17:              }
  19:              // Your TFS site
  20:              Uri _tfsUri = new Uri("");
  22:              NetworkCredential _credentials = new NetworkCredential(UserName, Password);
  24:              TfsTeamProjectCollection server = new TfsTeamProjectCollection(_tfsUri, _credentials);
  26:              server.Authenticate();
  28:              WorkItemStore = server.GetService(typeof(WorkItemStore)) as WorkItemStore;
  30:              // Query for a project named Tasks Collection
  31:              workItemsCollection = WorkItemStore.Query(@"SELECT [Title] FROM WorkItems WHERE [Area Path] UNDER 'Tasks Collection'");


With the first few rows, we are looking inside our SharePoint for a secure store application with ID LiveIDSecureStore. Then we assign its user name and password stored credentials to our credentials.

Then we get the TFS site. Please note that, it is without the project.

After successful authentication to the server, we query the project called Tasks Collection.

The returned object is used furthermore in our read item and read list methods as you have seen earlier.


We have demonstrated how you could connect securely with SharePoint Secure Store Service to Azure TFS Preview and retrieve your project tasks, backlog items and bugs with Business Connectivity Services. Once in SharePoint, you can further play with the data, such as applying filtering, grouping, etc. using Infragistics Grid Web Part.



To learn more about the Grid web part, check the online samples.

For the other Infragistics SharePoint web parts, check the web site.

For the official documentation, follow this link.

Comments  (1 )

Kiril Iliev's blog
on Fri, Jun 22 2012 9:16 AM

You’ve managed to impress your manager, showing the current progress of your Team Foundation Services