Open Office Communicator Session from C#

1.5k views Asked by At

I am working on a WPF application and I wish to open sip:[email protected] links. I am able to open mailto links using the following code:

private void btnSendEmail_Click(object sender, RoutedEventArgs e)
{
    try
    {
        string mailURL = String.Format("mailto:{0}", UserDetails.EmailAddress);
        Process.Start(mailURL);
        Close();
    }
    catch
    {
        // Handle exception
    }
}

Although, I am unable to open sip: links in a similar way. What I am trying to achieve is to open a new chat session with a user, like I am able to do when I follow sip: links from Outlook.

Any ideas?

Edit: I ended up using the CommunicatorAPI. Messenger.InstantMessage() seems to work for me. More info here: http://msdn.microsoft.com/en-us/library/bb787232.aspx

5

There are 5 answers

0
Sayak Banerjee On BEST ANSWER

I ended up using the CommunicatorAPI. Messenger.InstantMessage() seems to work for me. More info here: http://msdn.microsoft.com/en-us/library/bb787232.aspx

3
plmaheu On

You probably need to associate a program with the "sip" uri scheme. Try this: how do I create my own URL protocol? (e.g. so://...)

1
Justin On

Using Process.Start works fine on my system (with Microsoft Lync 2010, a newer version of Communicator):

void Main()
{
    Process.Start("sip:[email protected]");
}

Running the above code results in a new chat window opening. The only exception is when I enter my own user name, in which it starts composing a new Outlook e-mail message to myself. What happens when you use this (maybe also try omitting the following call to Close).

0
Paul Nearney On

if you have Lync or Office Communicator installed, they should respond appropriately to the sip: uri scheme. Also, tel:, callto: etc. For reference, the full list is here.

Is this not working for you from a WPF app? Does it work for you from a basic html page?

0
flip66 On

The following code probably didn't work for you because you were trying to IM yourself.

Process.Start("sip:[email protected]");