How to retrieve IM message from lync client 2013 communication
Asked Answered
E

1

2

I am using lync 2013 sdk and i need to create a task with conversation IM message on the end of call.

I want some method as - conversation.getIMmessage() etc.

how can i implement that.

Ehlke answered 12/8, 2014 at 11:51 Comment(2)
You would stand a better chance of getting an answer if you share with us what you've tried so far. e.g. have you looked at the samples in the SDK?Nemesis
yes, I have tried to retrieve message with InstantMessageReceived event. But I want to fetch old IM message or History.Ehlke
U
0

So assuming you are using the Lync Client SDK you are going to need to add an event handler for IM received to the IM modality of each participant in a conversation. This is best considered in reverse order:-

Set up an event handler for participant being added to a conversation:-

Conversation.ParticipantAdded += Conversation_ParticipantAdded;

In that event handler get the IM Modality for that participant, with something like:-

var imModality = Conversation.Participants.Single(p => p.Contact.Uri.Equals(newParticipantSIP, StringComparison.CurrentCultureIgnoreCase)).Modalities[ModalityTypes.InstantMessage] as InstantMessageModality;

And then add a IM received event handler to the modality:-

imModality.InstantMessageReceived += (sender, e) =>
                {
                    DoStuff(e.Text);
                };
Uniliteral answered 13/8, 2014 at 8:47 Comment(3)
Using this I will get current messages. How can I get some old history messages? But Thanks a lot, I have tried it.now I have to fetch IM History.Ehlke
you could record all conversations and save or dump the content as appropriate.Uniliteral
I was thinking for same thing. Thanks a lot. That really helped me.Ehlke

© 2022 - 2024 — McMap. All rights reserved.