2

I am trying to create a messaging app using Lync 2013 sdk in UI suppression mode, i am using the following code to send message to all participants in the conversation, but i can't find a way to send a message to specific one of them, do anyone know how to do this?

My Code:

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

        }

if this can't be done using the conversation please guide me to the right way, any help appreciated.

Anas
  • 711
  • 7
  • 24

2 Answers2

2

There isn't a way to be selective of the recipients of an IM in a given conversation. Your best bet is probably to start a separate conversation with just the participants you need.

Paul Hodgson
  • 939
  • 8
  • 15
  • I believe this is not performance optimized, i will use it as last solution (if i don't find another way to solve it), thanks @Paul. – Anas Mar 07 '14 at 19:11
  • I understand your concerns re performance however Lync server would remain performant with thousands of open conversations and the overhead of conversations on the client is minimal. I think even if this was a feature (which it isn't) it would be likely to work by starting another conversation because that is essentially what you are trying to do. – Paul Hodgson Mar 09 '14 at 10:48
1

I agree with the selected answer ... but ... as you're writing a UI Suppression App, you can use a separate IM conversation (as per the answer) but then present it inline. As you're controlling the display of the conference, you can display it however you want, if that's really what you want to do.

Tom Morgan
  • 2,355
  • 18
  • 29