2012-05-19 68 views
5

我正在将IM Presence信息编码到我公司的silverlight应用程序之一中。到目前为止,我唯一找到的解决方案就是CodePlex(Silverlight.OCS)。这是“好的”,但它非常过时。我可以使用Microsoft Lync API与Communicator 2007/2007 R2进行通信吗?

Lync SDK使得在Silverlight中获得存在信息变得异常容易。不幸的是,我们网络中99%的用户仍然使用OFfice Communicator(R2),因此使用开箱即用的Lync方法(控件:xaml中的PresenceIndicator ...)无法正常工作。

因此,我很好奇Lync SDK是否包含与Office Communicator通信的方式?

如果是这样,我将如何a)检查客户端正在运行,然后b)连接到该客户端 - 无论是Lync还是Communicator。很感谢任何形式的帮助!最后但并非最不重要的 - 如果可能的话,我正在寻找C#代码。谢谢!

+0

查看['NameCtrl'](http://msdn.microsoft.com/zh-cn/library/ms455335)ActiveX控件。你可以从中获得存在。 –

回答

2

不能使用对Office Communicator的,只有2010年的Lync

SDK的前世是Office Communicator的自动化API(OCAA)在2010的Lync SDK。这是一个基于COM的API,并且可用于通信2007和2007 R2。它仍然支持......现在!您可以下载API here。 MSDN登录页面是here

至于获取存在信息......嗯,希望这可以帮助你(与我太年轻了,没有做过任何OCS API工作免责声明;)

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; 
    } 
} 

返回联系人的状态:

IMessengerContact接口定义属性Status,其中包含多个MISTATUS值之一。

相关问题