Thursday, December 8, 2011

Instant Profile Manager

Have you ever wished that it was easier to switch between accounts in Microsoft Communicator?

Having to do this every time you switch accounts is less than ideal...
Here at Instant Technologies, we've been doing a lot of work of late around Microsoft Lync 2010.  One minor, but irritating issue that we have faced is that there isn't really a good way to switch between accounts on the vanilla Lync Communicator client.  For the typical Lync user, that's probably not a big concern, but in our development environment, it becomes irksome rather quickly, particularly since it is not possible to run multiple instances of the client at the same time.  Some sort of tool to automate logins, and preserve more than a single set of credentials would be very helpful for in-house testing and development purposes.

We decided to spend a couple days ginning something up that we could use internally, and add another Microsoft API to our toolbox in the process.  It's proven fairly useful for testing and development here, and so we have decided to release it to the community.

Instant Profile Manager in action

  • Stores log in credentials for an arbitrary number of Lync accounts.
  • Passwords can be stored, or, if you prefer, you can be prompted each log in.
  • Option to manually set the fully-qualified domain name of the server pool, so that you can easily switch between users on different pools.
  • Log in to a Lync account with just a couple clicks.
Here is a video demonstration of Instant Profile Manager in action. link

Setting up a profile in Instant Profile Manager

  • Microsoft .Net Framework 3.5
  • Microsoft Lync 2010 Communicator Client

Download Link: Instant Profile Manager (ZIP)

If you're interested in how we did it, read on...

As it turns out, it is relatively simple to automate logins to the Lync Client, using the Microsoft Lync 2010 SDK (SDKDocs).  The heavy lifting is mostly handled by the LyncClient class, which exposes functions to sign in and out, and (although we haven't explored it yet) it would appear contact management and messaging are available as well.

We save the profile list as XML, to the current user's My Documents folder.  It'a a dead-simple implementation, using the .Net XmlSerializer to handle transforming our list of Profile objects into XML for us.

Since the Communicator client sets a registry key (HK_CurrentUser/Software/IM Providers/Communicator/UpAndRunning), it is a simple matter to check, and then launch the client if it is not running.  One caveat, for users with 64-bit systems, or who have installed Lync to a non-default location: You will need to edit ProfileManager.exe.config and set "PathToClient" to point at the location your communicator client is installed to.

We made an effort to also support OCS 2007 R2, as we also have a number of products that we regularly test targeting that platform, but by all indications, the Microsoft Office Communicator 2007 SDK doesn't work, or at least not with the 3.5.6907 version we are using.  Specifically, the IMessenger.Signin method doesn't seem to do any more than pop the client window up, regardless of the values passed as parameters.  Perhaps this once worked, as there are a number of examples citing it (see Programming for Unified Communications, Chapter 3), but it is now marked deprecated, suggesting that IMessenger.AutoSignin() be used instead, which is wholly unsatisfactory for our purposes.  While there appear to be some hacks one can do to make a Lync Client connect to an OCS 2007 R2 server, we didn't have much luck, and so had to abandon the idea of supporting 2007.