The new Team Foundation Server (currently in beta 2) has the option to connect TFS project to an existing SharePoint site. This also allows you to specify on which SharePoint server to create new project sites. For us this is important, because a lot of our projects start way before the TFS project gets created. Then we end up moving all files to the TFS project site, or we have two project sites for the same project. When we go live with TFS2010, we no longer have to transfer files. And we can host the TFS project sites on our company SharePoint implementation, which means 1 WSS server less to maintain. With one of my colleagues we managed to get this working in our test environment. This post shows you how we have set it up.
Step 1 – Configure SharePoint site setup
TFS has two options for linking TFS projects to SharePoint sites, and it is important to think about this before you start configuring:
- Automatically – if you create a new TFS project, TFS will automatically create the new SharePoint site for you. This will be a sub site in the site collection that you specify for for each Team Project Collection in TFS. This collection is a group of TFS projects. For each new project, a new subsite is created in this site collection. If this site collection is using a managed path, you will have to remember this managed path.
Apart from the managed path (in case you are using that) you need to remember the web application that hosts your site collection(s) and the service account that runs the application pool of this web application. You can also configure TFS to automatically create the site collection that is associates to your project collection (make sure self service site creation is switched on!). We have not yet tested this setup. - Manually – You are manually creating SharePoint project sites and your TFS projects and after both are created, you manually connect them from TFS. If this is the case, you will need to write down all the SharePoint application URL that will host project sites, including their application pool accounts. If these SharePoint sites are using managed paths, you need to write down these as well.
We will go for the second option, as we want some more control over where the SharePoint sites are created. Apart from that, they probably already created before the TFS project is created. The samples below show our very simple test setup. We have configured 1 web application, with 1 managed path (tfsprojecten). We will manually create a site collection for each project at the url http://<web_application_url>/tfsprojecten, and connect the TFS project later on to the root site of that site collection.
Step 2 – Configure TFS connection to SharePoint
In this step we will configure which SharePoint service accounts have access to TFS. On the TFS server, start the Team Foundation Server Administration Console. In the Application Tier select SharePoint Web Applications.
In the lower section of the screen, “Service Accounts for SharePoint Web Applications”, add the accounts for 2 web applications:
- The Central Administration web application
- The web application that will host your project sites (can be accounts of multiple web applications)
The accounts that you need to add here are the accounts of the application pools that are associated with these web applications:
For the next step, we stay in the console on the same screen. In the SharePoint Web Applications section, click Add SharePoint Web Application:
Enter a friendly name for the web application, that makes it easy to recognize. Fill in the url of the web application (step 1) and the url of the SharePoint Central Administration site. If you have your site collection(s) using a managed path in SharePoint, enter this managed path in the Default location textbox.
Step 3 – Configure SharePoint connection to TFS
Before we configure the connection from SharePoint to Team Foundation Server, make sure the Team Foundation Server Extensions for SharePoint Products are installed in the SharePoint farm. See the installation guide for more details. On the SharePoint server, start Team Foundation Server Administration Console. Select Extensions for SharePoint Products. Click the Grant access button to setup a new connection.
Enter the url to your TFS server and select a web application. If you have configured a managed path in SharePoint and you want to enforce TFS to create all new site collections for new project collections in that path, enter your path here as well.
Step 4 – Configure the project collection(s)
If you have already added created project collections in TFS, you need to configure the connection for each collection to SharePoint. On the TFS server, start the Team Foundation Server Administration Console. Select Team Project Collections and select your collection. Navigate to the SharePoint Site tab.
Click the Edit Default Site Location button. Select your web application (recognizable from the friendly name you configured in step 2). Check if TFS configured the url for your site collection correctly. If you configure the connection manually, this has to be an existing site collection, and the url that TFS suggests here (based on your input from previous steps), must match the url of that site collection.
If the url does not match, you can manually change the path here. If you want TFS to do the work for you, you are done now. As soon as you add a new TFS project to the project collection, TFS will create the new project and the wizard will ask you for the required details:
If the url that the Team Explorer wizard proposes here does not match your SharePoint site collection, you can correct it here, or check the previous steps if you have missed one.
If you did not yet create a project collection, or want to create a new one, you should also be ready now. As soon as you create a new collection from the console, the wizard has an extra step SharePoint Site. In this step a new site collection gets created in the web application that you select from the dropdown (again, recognizable from the friendly name):
Step 5 – Configure the connection manually
In our case we wanted to configure a TFS project to an existing SharePoint site. You can manually configure this connection from Team Explorer. Right click the project, select Team Project Settings and select Portal Settings.
Next, check the Enable team project portal checkbox in the popup window. Then click the Configure URL button. In the popup windows that appears, select the web application that hosts your SharePoint site.
If the url that is suggested here does not match the url of your SharePoint site, make sure you did not miss one of the previous steps, or manually change it.
Step 6 – Configure your SharePoint site
This step is only relevant if you manually connected your TFS project to your SharePoint sites. If TFS created your team site, the site is already configured based on the template. If you successfully connected your TFS project and SharePoint team site, you can start using web parts from the new Visual Studio Team System Web Part Collection. To use these web part, active this site collection feature:
Now you can use these web parts on any SharePoint page in your site. Simply add one or more web parts to a page and configure them. The screenshot below shows the home page of a Collaboration Portal that is configured as the project site for our test project in TFS.
This is not something that I would recommend or would do in our production environment once we migrate to 2010, but it shows that the integration of TFS in SharePoint is built very nicely using web parts, which makes it very flexible. The web part collection has a number of different types of web parts. The screenshot below shows an overview.
These webpart are pretty clever. They ‘know’ the connection to the team foundation server themselves. If you add the Team System Web Access Shortcut Web Part for example, you do not need to configure it. It automatically finds the connection to the TFS server and renders the correct link to TSWA. Nice!
Other web part, like the Query Results Web Part need some additional configuration. Using the Query Picker, you select one of the queries on that’s it. You have a web part in your site showing all your open tasks for example:
Conclusion
Hope this post helps to clarify a bit how SharePoint 2007 and TFS 2010 will integrate. I would recommend playing around with this in a lab environment to find the best option for your organization. Put a TFS administrator and an experienced SharePoint administrator in the team to set this up, because together these people should be able to figure out how to set it up. We have done this and are enthusiastic about the options this gives us in the near future!
Starting point for your journey should be the MSDN documentation.