silverlightcomoffice-communicator

Calling Communicator.UIAutomation from Silverlight 4


I'm trying to instantiate a COM connection to Communicator 2007 from an Out of Browser Silverlight 4 app. I'm following some sample code - one (slightly different) example of which is here - but I'm getting an error when I run the following line:

dynamic communicator = AutomationFactory.CreateObject("Communicator.UIAutomation");

The error is:

Failed to create an object instance for the specified ProgID.

I've downloaded and installed what I believe is the right SDK, but OLEView isn't showing the DLL's as registered - is there something I need to do to register the DLL's in the SDK? regsvr32 doesn't seem to work.

Am I going about this all wrong? Is there a better option, perhaps with the Unified Communications Client (1.0 or 2.0) SDK?


Solution

  • Is Communicator running at the time? It must be running in order to use the API.

    The above code works fine for me, when communicator is running, but I can replicate your error by ensuring that it isn't running when the above line gets hit.

    I'm pretty sure the SDK is registered OK, as you'g get a slightly different error if it wasn't:

    No object was found registered for specified ProgID.
    

    With regards to the right SDK - it depends on what you're trying to achieve. The automation API (i.e. the one you're using) will allow you to automate the running instance of Communicator, so its great for e.g. obtaining presence info, starting IM conversations, placing phone calls etc uning the Communicator UI. You should only need to look at UCCA if its not guaranteed that Communicator will be running, or if you need to e.g. provide your own UI.

    I blogged about the various APIs here

    One more thing to bear in mind, if upgrading to Lync is an option, then the SDK has a whole bunch of really useful Silverlight/WPF controls built in - some info here