[英]lync 2010 sdk can't catch received conversation message
我使用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;
}
上面使用的事件用於上下文數據,如果要獲取IM文本,則可能不是您想要的。 您想要的事件是InstantMessageReceived事件。 下一篇文章對此進行了描述(這是Lync 2013的文章,但也適用於2010):
在這里,您可以看到該文章中某個部分的屏幕截圖:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.