Examining Future Possibilities

So far you have learned about the different ways that Team Foundation Server currently addresses some of the challenges related to teams and communication. However, this is just the tip of the iceberg. Team Foundation Server was designed with extensibility in mind, and this extensibility makes possible a whole range of new ideas.

This section addresses some of the possible scenarios for the future, which include communicating with Team Foundation Server via instant messenger and Microsoft Outlook. In fact, one of them is possible now, thanks to the hard work of a third-party company called Personify Design. These are just a few examples of how the object model might be used to leverage Team Foundation Server in new and exciting ways. We also look at a real example of having Team Foundation Server send instant message alerts to users.

Receiving Tasks via Instant Messenger

Instant messaging is here to stay, and corporations are working on determining the best way to integrate it into their daily processes. You know that you can already set up Team Foundation Server to e-mail you if there is a problem with your build, or whenever code is checked into the Team Foundation source control system. However, you don't always check your e-mail right away, so you may not be alerted in as timely a manner as you would like.

What if you had Team Foundation Server send you an instant message about the build instead? Or what if you had Team Foundation Server send you an instant message any time you had a new task assigned to you in the Team Foundation work item tracking system? Utilizing the Team Foundation Server Object Model and the Team Foundation eventing service, this scenario, and others like it, are just some coding away from reality. So enough talk, let's try to actually write some code that enables Team Foundation Server to send you an instant message.

Here is the scenario: You have a manager, named Developer2, who wants to be alerted via instant messenger anytime a work item has been changed. And yes, while this could lead to a lot of alerts, he wants it, so you are going to give it to him. No matter what is changed on the work item, he wants to be made aware of it through an instant message.

First, there are some prerequisites. You need to be running Microsoft Live Communication Server 2005, and have an Active Directory. Users need to be using Microsoft Office Communicator, and Office Communicator needs to be installed on the Team Foundation Server. Finally, you need to set up a user in your Active Directory that will be used for sending instant messages, and give that user access to the Live Communication Server. These are things your network administrator should be able to help you with.

The first thing you need is a way to actually send an instant message programmatically. For this particular example, you need a way to send an instant message from the command line. To do this, you need to install the Windows Real-Time Communication Client API SDK 1.3 on the Team Foundation Server. This SDK is available for download at microsoft.com/downloads/details.aspx?familyid=&displaylang=en. This SDK installs the latest version of the realtime communication DLL, which is needed for the code samples.

Once this SDK is installed, you need to download the cmdSendIMApp.zip from the Wrox Web site (wrox.com). Unzip the contents of this archive to the C:\cmdSendIM directory. Before you can use this application, you need to configure it by telling it what user to log onto the Live Communication Server as. Team Foundation Server will send instant messages as this user. To do this, open the app.config file located in the C:\cmdSendIM directory. Find the <appSettings> section of the configuration file. There are four key settings you need to change:

  • domainuser - This is the domain user you want to send the IM message from. The format is <domain>\<username>.

  • password - This is the password for the domain user.

  • sip - This is the sip value for the domain user for Live Communication Server. More than likely it will be sip: <username>@<domain>.

  • server - This is the Live Communication Server name.

To view the actual code for this utility, download the cmdSendIMCode.zip file from Wrox. This code is based on code by Glen Scales from his blog post on sending an instant message programmatically via Live Communication Server (outlookexchange.com/articles/glenscales/lcssprg1.asp).

To send an instant message using this command-line application, open a command-prompt window, and navigate to c:\cmdSendIM. The syntax for sending a message is:

 cmdSendIM <user> <message> 

So, to send a message to Developer2, run the following in the command prompt window:

 cmdsendIM developer2@vsts.com Here is a test message 

If Developer2 is online in Office Communicator, he will receive an instant message, similar to that shown in Figure 14-3.

image from book
Figure 14-3

You want Team Foundation Server to alert Developer2 anytime a work item changes. To do this, you need to build a Web service that will listen for the WorkItemChangedEvent from Team Foundation Server. When this event is fired, this Web service uses the above command-line application to send the work item details in an instant message.


You need to grant the TFSSERVICE user read and execute privileges to the cmdSendIM directory. This allows TFSSERVICE to run this application from the Web service.

To download the Web service files, download the SendIMWS.zip file. To download the project and code for this Web service, download the WorkItemChangedWSSendIM.zip file.

Let's examine the code for this Web service, WorkItemChangedWSSendIM.asmx, to get a basic understanding of how it works. Every Web service that is going to tie into the Team Foundation Server eventing service must implement the following method:

 [SoapDocumentMethod(Action = "http://schemas.microsoft.com/TeamFoundation/2005/06/ Services/Notification/03/Notify", RequestNamespace = "http://schemas.microsoft.com/ TeamFoundation/2005/06/Services/Notification/03")] [WebMethod] public void Notify(string eventXml, string tfsIdentityXml) { ... } 


You need to add using System.XML and using System.Diagnostics to the top of the Web service to utilize the XML services and process services in this example.

Team Foundation Server will call this Notify method. eventXml will hold the event information written in an XML format. tfsIdentityXml holds the name of the Team Foundation Server that called the Web service.

The following code is contained in the Notify method.

 XmlDocument myXmlDoc = new XmlDocument(); myXmlDoc.LoadXml(eventXml); XmlElement myData = myXmlDoc.DocumentElement; //Retrieve Information From the Document string title = myData.SelectSingleNode("Title").InnerText; //Create IM message string Msg = "Work Item Has Changed. Title = " + title.ToString(); Process p = new Process(); p.EnableRaisingEvents = false; string strCmdLine = "/C C:\\cmdSendIM\\cmdSendIM.exe developer2@vsts.com " + Msg.ToString(); p = Process.Start("C:\\cmdSendIM\\CMD.exe", strCmdLine); p.Close(); 

The first three lines of code take the XML data sent by Team Foundation Server, and loads it into an XML document, so you can search over and manipulate it. For this instant message example, you are grabbing the <Title> element from the message, which contains the team project name, the work item name, and the work item number, and sending that title information in an instant message. Using the myData variable, you can select the title out of the XML document.

Once you have this title, you create a string that contains the message you want to send. Remember, you are going to call our command-line application to actually send the instant message. To call an external application from a Web service, you use System.Diagnostic.Process by opening a command-prompt window, and then calling the cmdSendIM.exe application.

First, create the string that you want to run from the command line:

 string strCmdLine = "/C C:\\cmdSendIM\\cmdSendIM.exe developer2@vsts.com " + Msg.ToString(); 

/C tells the command prompt to carry out the command in this string, and then terminate the command prompt. As you can see from the string, you are executing the cmdSendIM application, sending a message to developer2@vsts.com, with the contents of the message being the string you built previously.

Next, you need to actually trigger the process to run:

 p = Process.Start("C:\\cmdSendIM\\CMD.exe", strCmdLine); 

This line of code opens a command prompt, and then runs the previously mentioned string. Finally, once the process has finished running, you close the process.

Now that you have a basic understanding of how the Web service will work, let's get it installed. Unzip the contents of the SendIMWS.zip file to C:\SendIM on the Team Foundation Server. This directory contains a Web service called WorkItemChangedWSSendIM.asmx. To use this Web service, you need to set up a virtual directory in ISS under the Team Foundation Server Web site, which points to this directory:

  1. To do this, right-click the My Computer icon, and select Manage. This opens the Computer Management window.

  2. Navigate to Services and ApplicationsIIS ManagerWeb SitesTeam Foundation Server.

  3. Right-click Team Foundation Server and select NewVirtual Directory. Following the steps of the wizard, name the virtual directory WorkItemChangedWSSendIM, and point it to the C:\SendIM directory.


Currently, the user to send an instant message to is hard-coded in the Web service. To make this example work, you will need to edit the Web service to change the user to a user on your network.

Once the virtual directory is set up with the Web service, the next step is to link the Web service into the Team Foundation Server event model. To do this, you need a tool called BisSubscribe, located in the Visual Studio 2005 SDK. This SDK is available for free download at http://msdn.microsoft.com/vstudio/extend. The bissubscribe.exe utility is a command-line utility you can use to register your Web service with Team Foundation Server. It allows you to link your Web service to events that are fired with Team Foundation Server, so that when specific events are called, you can have Team Foundation Server trigger your Web service as well. It also allows you to subscribe to events via e-mail.

The general syntax for using bissubscribe is

 Bissubscribe /eventType <MyEvent> /userId <MyDomain\\MyID> /address <webservice> 

There are some other optional parameters. For a full list of parameters for bissubscribe, run bissubscribe.exe /? from the command prompt.

Developer2 is interested in receiving notifications any time there is a change in the work item. Therefore, he is interested in the WorkItemChangedEvent event type. To register your Web service for Developer2, you would use the following command:

 Bissubscribe.exe /eventType WorkItemChangedEvent /userID vsts\Developer2 /address http://dstfs:8080/WorkItemchangedWSSendIM/WorkItemChangedWSSendIM.asmx 

This command registers Developer2 for the event type WorkItemChangedEvent. Any time that event is fired, the WorkItemChangedWSSendIM.asmx Web service will be called.

Everything has been set up, so now it is time to put this Web service to use.

  1. Log on to Office Communicator as Developer2.

  2. Open Team Explorer, navigate to a Team Project, right-click the Work Items folder, and select Add Work ItemScenario.

  3. Enter a title for the scenario, and click Save. The work item is saved, and shortly thereafter, an instant message will be sent to Developer2, alerting him that a work item has been changed, as shown in Figure 14-4.

image from book
Figure 14-4

Some final caveats with the code provided in this example. The user you are sending an instant message to is hard-coded into the Web service at this time, which makes this option a bit limited. One possible enhancement would be to take the work item information, extract the user it is assigned to, query the active directory to find his instant messaging address, and then send him that instant message. This would allow people to be notified whenever a work item assigned specifically to them is modified. This code gives you a foundation for instant messaging to build off, to create the solution you need. And it is yet another example of how the extensibility of Team Foundation Server can be used in new and creative ways.

Tracking Project Status via Outlook

Most people who deal with Microsoft technologies live in Microsoft Outlook. They would be much more comfortable interacting with Team Foundation Server, and much more likely to do it on a consistent basis, if they could do it from Outlook. One option you have is to write your own extension to Outlook, utilizing the Team Foundation Server Object Model, to allow users to access different parts of your Team Foundation Server. Or you could turn to an already existing solution from a company called Personify Design (www.personifydesign.com).

More and more people are becoming involved in the software development lifecycle. Personify Design has developed an extension called TeamLook for Microsoft Outlook 2003 that allows all project users to communicate more effectively and accurately on the project status using one of the most commonly used and understood communication tools. This extension connects to Team Foundation Server and allows you to view work items, reports, and other information stored on the data tier. You can connect to multiple Team Foundation Servers, and multiple projects on those servers.

Figure 14-5 shows an example of what TeamLook looks like in Outlook.

image from book
Figure 14-5

As you can see, all the different team projects you are interested in are listed on the left side. For each team project, you can view your personal queries or the reports and team queries defined for the project. This image shows the All Tasks query for the CustomCheckInPolicy project. Notice the tool bar along the top. By highlighting a task, you can create a new e-mail or meeting invitation, with the work item embedded in the message. You can reassign the work item to another team member or change the state of a work item, and update all this information back into Team Foundation Server without leaving Outlook. You can double-click a work item to view its information in a window almost identical to what is displayed in Team Explorer, as shown in Figure 14-6.

image from book
Figure 14-6

Here you are seeing Task #25. This window looks very similar to the one you see in Team Explorer, containing all the work item information. However, notice the three buttons running along the top of the window. You can click any of those buttons to create a new e-mail, meeting invitation, or personal task. And when you do, it will automatically copy of the contents of the work item into whatever you have created. Using this tool, you have a nice way to continue using Outlook, without having to cut and paste, or jump through a lot of hoops to get information from Team Foundation Server.

Another great feature is the ability to run reports against Team Foundation Server from directly inside Outlook, and then create an e-mail with the report as an attachment. Moreover, if you create a meeting invitation based off a work item, TeamLook actually figures out who should be invited, based on the context of the work item. TeamLook allows you to use both Team Foundation Server and Microsoft Outlook in synergy, creating an effective project management communication tool. It even allows you to view the team project portal from within Outlook.

For your users who can't live without Outlook, and don't want to open a separate tool for accessing Team Foundation Server, TeamLook or a custom-built in-house plug-in, are definitely the way to go.

Microsoft Groove 2007

Microsoft will be releasing a new version of their collaborative environment software, Groove 2007, alone with Microsoft Office 2007 later this year. Groove 2007 provides users the ability to create a collaborative workspace on their machine and to invite people to participate in that workspace. This makes it easy to keep team members up to date on the latest information concerning the project. This workspace provides all the tools and information that team members need in one place.

So how does this tie back into Team Foundation Server? There are a couple of possibilities. Groove 2007 can share information with Windows SharePoint Services sites. You could tie your Groove workspace into a particular Team Foundation Server project site, enabling you to quickly and effectively access information from the project site without leaving your workspace. In addition, it may be possible to create custom Groove controls, enabling accesses to different pieces of Team Foundation Server, such as work item tracking information. None of this exists now, but by building off the Team Foundation Server Object Model, you could create it. As well, Groove 2007 also integrates with Communicator 2005, which ties back into receiving your work item notifications via instant messaging.

 For more information on Groove 2007, visit www.microsoft.com/office/preview/ programs/groove. 

Professional Team Foundation Server
Professional Team Foundation Server
ISBN: 0471919306
EAN: 2147483647
Year: 2004
Pages: 168

Similar book on Amazon
Professional Team Foundation Server 2010 (Wrox Programmer to Programmer)
Professional Team Foundation Server 2010 (Wrox Programmer to Programmer)
Professional Application Lifecycle Management with Visual Studio 2010 (Wrox Programmer to Programmer)
Professional Application Lifecycle Management with Visual Studio 2010 (Wrox Programmer to Programmer)
Professional Scrum with Team Foundation Server 2010 (Wrox Programmer to Programmer)
Professional Scrum with Team Foundation Server 2010 (Wrox Programmer to Programmer)
Team Foundation Server 2008 in Action
Team Foundation Server 2008 in Action

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net