2014-02-16 35 views
0

我使用lync 2010 sdk並使用lync wpf應用程序進行開發。 我可以發送消息給一個組或一個人,但不能捕獲收到的消息文本。lync 2010 sdk無法捕獲收到的會話消息

像添加新對話時可以捕獲的代碼一樣,但無法讀取消息文本。

有誰知道我該怎麼做?

private Conversation _conversation; 
    LyncClient _LyncClient; 

    void ConversationManager_ConversationAdded(object sender, Microsoft.Lync.Model.Conversation.ConversationManagerEventArgs e) 
    { 
     if (_conversation == null) 
     { 
      _conversation = e.Conversation; 
     } 
     string getmessage=_conversation.GetApplicationData(_AppId); 
     _conversation.ParticipantAdded += _conversation_ParticipantAdded; 
     if (_conversation.Modalities[ModalityTypes.InstantMessage].State != ModalityState.Notified) 
     { 
      _RemoteContact = _LyncClient.ContactManager.GetContactByUri("sip:xxx @xxx.com.tr"); 
      _conversation.AddParticipant(_RemoteContact); 
     } 
     e.Conversation.InitialContextReceived += Conversation_InitialContextReceived; 
     e.Conversation.ContextDataReceived += Conversation_ContextDataReceived; 
     e.Conversation.StateChanged += Conversation_StateChanged; 
     ((InstantMessageModality)e.Conversation.Modalities[ModalityTypes.InstantMessage]).InstantMessageReceived += MainWindow_InstantMessageReceived; 
    } 

回答

0

您上面使用的事件是上下文數據,如果您想要獲取即時消息文本,這可能不是您想要的。您想要的事件是InstantMessageReceived事件。它在下面的文章中描述(這是一個的Lync 2013的文章,但應該在2010年的工作以及):

How to: Start a Lync IM conversation

這裏你可以看到一個部分的屏幕帽文章:

enter image description here