views:

188

answers:

2

I need to invoke office communicator to create a chat window and phone call directly from Silverlight when running out of browser. When running in browser I do this and it works pretty well:

System.Windows.Browser.HtmlPage.Window.Eval(String.Format("window.open(\"sip:{0}\", target=\"_self\");", sip));

When running out of browser as far as I have gotten is to invoke the Communicator.UIAutomation via a dynamic but honestly I don't know what to do next.

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

Anyone have any suggestions on how to make this work? Searching has yeilded zero results.

A: 

A couple thoughts:

Have you tried making the automated Communicator object a var, then setting a breakpoint and digging into the resulting hydrated object? You might find some methods or properties on the object you can use to make things happen.

There's a blog here that describes the Office Communicator SDK and has some sample projects. I think you might be able to include the SDK assemblies in your OOB app and automate Communicator using Microsoft's provided SDK.

Dave Swersky
I tried the "var" trick but it sets it as an automation which is basically back to being a dynamic.
Keith Elder
A: 

The SDK has to be preinstalled in the user machines. There's no easy way to deploy it along your Silvelright OOB application.

You will need the SDK.

You can check the documentation for more details here: C:\Program Files (x86)\Microsoft Office Communicator\SDK\OCSDK.chm It mainly refers to C#, but most of it could easily be ported to Com Automation. As an example look at the following code to start a conversation

dynamic comm = new ActiveXObject("Communicator.UIAutomation");
dynamic msgrAdv = comm.IMessengerAdvanced;
if(msgrAdv!=null)
{
    try
    {
        object obj = msgrAdv.StartConversation(
                   1, //CONVERSATION_TYPE.CONVERSATION_TYPE_IM,
                   sipUris, // object array of signin names
                   null,
                   "Testing",
                   "1",
                   null);
        windowHandle = long.Parse(obj.ToString());
    }
    catch (COMException ex)
    {
        this.writeToTextBox(
                formReturnErrors.returnComError(ex.ErrorCode)
    );

}

I hope this help. Noticed that from the example in the help file I changed some of the members that are defined in the .NET Assembly (which can't be referenced from your C# code). If you need this, I would suggest opening the CommunicatorAPI.dll assembly in Reflector.

Miguel Madero