0
votes

I use lync 2010 sdk and develop with lync wpf application. I can send message to a group or a person but can't catch the received message text.

like the code ı can catch when a new conversation added, but can't read message text too.

Does anyone know how can ı do it?

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

1 Answers

0
votes

The events you're using above are for contextual data, which may not be what you want if you want to get IM text. The event you want is the InstantMessageReceived event. It's described in the following article (it's a Lync 2013 article but should work for 2010 as well):

How to: Start a Lync IM conversation

Here you see a screen cap of a section in that article:

enter image description here