我使用lync 2010 sdk并使用lync wpf应用程序进行开发。 我可以向群组或个人发送消息,但无法捕获收到的消息文本。
就像代码ı可以在添加新会话时捕获,但也无法读取消息文本。
有谁知道怎么做呢?
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 :(得分:0)
您上面使用的事件是针对上下文数据的,如果您想获取IM文本,这可能不是您想要的。您想要的事件是InstantMessageReceived事件。它在下面的文章中描述(这是一篇Lync 2013文章,但也适用于2010年):
How to: Start a Lync IM conversation
在这里,您可以看到该文章中某个部分的屏幕截图: