Extending the new TFS Team Members Power Tool

Brian Harry

The October release of the Team Foundation Power Tools includes a new feature called “Team Members” that allows you to collaborate with your team even better.  One of the features is integration with instant messaging that allows you to see presence, IM, video, audio, etc from inside Team Explorer.  You can read more about the feature here: http://blogs.msdn.com/bharry/archive/2008/10/01/preview-of-the-next-tfs-power-tools-release.aspx.

One of the key design points of this new IM integration is extensibility.  The Power Tools included providers for Office Communicator and Live Messenger.  However, there are a ton of other IM systems/clients out there and we wanted to make sure no one would be left out in the cold.  As a proof point, one of our MVP’s has just announced a new provider for Skype.  You can read about it here: http://msmvps.com/blogs/vstsblog/archive/2008/11/13/skype-collaboration-provider-for-tfs.aspx.  Further, we’ve created a CodePlex project for people who want to write and share TFS collaboration providers (and the Skype provider will be uploaded shortly).  You’ll find the CodePlex project here: http://www.codeplex.com/tfscollab

If you are interested in building a provider, you can look at the Skype example.  I’ve also included here some basic information on getting started.  I’ve attached in a zip file that contains the source code for all of the provider interfaces and support code.  You will find 3 files in the zip:

  • Interfaces.cs – The set of interfaces, abstract classes, enums, exceptions and the like that are necessary to write a provider.
  • CollaborationProviderBase.cs – Some base classes that implement portions of the provider interfaces and are likely to be the same regardless of your provider.  You can use them or not.  They may save you a little typing.
  • CollaborationProviderFactory.cs – Code that is used to enumerate available providers and to load them.  You really don’t need this code but it might be helpful if you are trying to understand why TFS is not finding your provider.

All of this is in the Microsoft.TeamFoundation.Collaboration.dll that comes with the Power Tool download – you can see them with intellisense, but having some of the comments might be useful.

You start building a provider by creating a class that implements ICollaborationProvider (or inherits from CollaborationProviderBase).  Implementing it will require to you implement a few more classes:

  • A class that derives from Contact for returning information about contacts that your provider knows about.
  • A class that implements IContactGroup (if your provider supports groups of contacts).
  • A class that derives from PhoneNumberCollection and one from PhoneNumber for returning phone numbers for a contact.
  • A class that implements IConversation for returning active conversations.
  • A class that derives from PresenceChangedEventArgs

Once you’ve built all of the classes you can copy your dll into the PublicAssemblies\CollaborationProviders folder under your Team Explorer installation and TFS will provide it as a choice in the list of available providers.

A few random comments that may help you getting started.

  • Much of the interface is optional (you don’t need to implement it).  The big hint is that if you look in CollaborationProviderBase, you will find some methods that are abstract and some that are implemented but throw a NotImplementedException.  You must implement the abstract methods.  You only need to implement the “NotImplementedException” methods if you want to.  I haven’t tested this distinction extensively but that’s the intent.  Let me know if I missed something.
  • Look at the CollaborationCapability enumeration that is passed to IsSupportedCapability.  This is another good way to tell the consumer about what capability your provider does (or does not) support.
  • ProviderName, ProviderReadiness, IsSupportedCapability, SignIn, AutoSignIn and SignInStatus need to work even when noone is singed in to the provider.
  • Before the rest of the interfaces can be used, the client must successfully sign in with AutoSignIn or SignIn.
  • Team Explorer does a lot of collaboration provider interaction on a background thread and some on a foreground thread – therefore your provider must work for both (and should never block the foreground thread if called on a background thread).
  • Team Explorer will call your provider on multiple threads simultaneously (it needs to be thread safe).
  • Look at the comments in interfaces.cs.  I’m a bit behind on documenting the methods but there’s a fair amount in there.  I’ll update it when I get a chance.

There’s probably more I should tell you.  Feel free to ask questions about anything you run into and I’ll update the post as I see more things people are going to want to know.




Discussion is closed.

Feedback usabilla icon