Can I use the Microsoft Lync API to communicate with Communicator 2007/2007 R2?

2.2k views Asked by At

I'm coding IM Presence information into one of my companies silverlight applications. So far, the only solution I've found is one on CodePlex (Silverlight.OCS). It's "okay", but it's extremely dated.

The Lync SDK makes it obnoxiously easy to get Presence information inside silverlight. Unfortunately, 99% of the users on our network are still on OFfice Communicator (R2), so using the out-of-the-box Lync method (controls:PresenceIndicator... in xaml) cannot work.

So, I'm curious if the Lync SDK contains a way to communicate with Office Communicator?

If so, how would I a) check what client is running and then b) connect to that client - be it Lync or Communicator. Any help is very much appreciated! Last but not least - I'm looking for C# code if at all possible. Thanks!

1

There are 1 answers

0
Tom Morgan On

You can't use the Lync 2010 SDK against Office Communicator, only Lync 2010.

The previous incarnation of the SDK is the Office Communicator Automation API (OCAA). It's a COM-based API, and will work against Communication 2007 and 2007 R2. It's still supported...for now!

You can download the API here. The MSDN landing page is here.

As for getting presence information...well, hopefully this might help you (with a disclaimer that I'm too young to have done any OCS API work ;)

Getting a contact record:

    private IMessengerContact FindContact(string userID)
{
    IMessengerContact contact = null;
    // Try the local contact list first
    try
    {
        contact = (IMessengerContact)communicator.GetContact(userID, "");
    }
    catch
    {
        contact = null;
    }

    // For a nonlocal contact, try the SIP Provider of Communicator
    if (contact == null || contact.Status == MISTATUS.MISTATUS_UNKNOWN)
    {
        try
        {
            contact =
                (IMessengerContact)communicator.GetContact(userID,
                communicator.MyServiceId);
            return contact;
        }
        catch
        {
            contact = null;
            return contact;
        }
    }
    else
    {
        return contact;
    }
}

Returning the status of a contact:

The IMessengerContact interface defines a property Status, which contains one of a number of MISTATUS values.