我正在尝试使用Lync 2013 sdk在UI抑制模式下创建一个消息传递应用程序,我使用以下代码向对话中的所有参与者发送消息,但我找不到向特定方式发送消息的方法其中一个,有人知道怎么做吗?
我的代码:
public void StartIMConversation(string participantUri)
{
_Conversation.PropertyChanged += _Conversation_PropertyChanged;
_Conversation = _LyncClient.ConversationManager.AddConversation();
}
void ConversationsManager_ConversationAdded(Object source, ConversationManagerEventArgs data)
{
data.Conversation.ParticipantAdded += Conversation_ParticipantAdded;
data.Conversation.StateChanged += Conversation_StateChanged;
data.Conversation.AddParticipant(_LyncClient.ContactManager.GetContactByUri(this.myRemoteParticipantUri));
data.Conversation.AddParticipant(_LyncClient.ContactManager.GetContactByUri(this.myRemoteParticipantUri2));
data.Conversation.AddParticipant(_LyncClient.ContactManager.GetContactByUri(this.myRemoteParticipantUri3));
InstantMessageModality imModality = (InstantMessageModality)participant.Conversation.Modalities[ModalityTypes.InstantMessage];
imModality.BeginSendMessage(message, SendMessageCallback, imModality);
}
private void SendMessageCallback(IAsyncResult ar)
{
InstantMessageModality imModality = (InstantMessageModality)ar.AsyncState;
try
{
imModality.EndSendMessage(ar);
}
catch (LyncClientException lce)
{
MessageBox.Show("Lync Client Exception on EndSendMessage " + lce.Message);
}
}
如果使用对话无法做到这一点,请指导我正确的方式,任何帮助表示赞赏。
答案 0 :(得分:2)
在给定的对话中,没有办法选择IM的接收者。您最好的选择可能是与您需要的参与者单独开始对话。
答案 1 :(得分:1)
我同意所选的答案......但是......当您正在编写UI抑制应用程序时,您可以使用单独的IM对话(根据答案),然后将其呈现为内联。当您控制会议的显示时,您可以根据需要显示它,如果这真的是您想要做的。