Calling Office Communicator via Silverlight Out of Browser

女生的网名这么多〃 提交于 2019-12-10 10:58:11

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/3506956/calling-office-communicator-via-silverlight-out-of-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!