Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6742939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:54:08+00:00 2026-05-26T11:54:08+00:00

This seems pretty basic, but I couldn’t find on the web how to do

  • 0

This seems pretty basic, but I couldn’t find on the web how to do this.

I have the following code:

public static void StartChatWithUser(Microsoft.Lync.Model.Contact imContact, string title = null)
{
    try
    {
        var lyncClient = Microsoft.Lync.Model.LyncClient.GetClient();

        var conversation = lyncClient.ConversationManager.AddConversation();
        conversation.AddParticipant(imContact);
        if (!string.IsNullOrEmpty(title))
        {
            conversation.Properties[Microsoft.Lync.Model.Conversation.ConversationProperty.Subject] = title;
        }
        var im = conversation.Modalities[Microsoft.Lync.Model.Conversation.ModalityTypes.InstantMessage];
        if (im.CanInvoke(Microsoft.Lync.Model.Conversation.ModalityAction.Connect))
        {
            im.BeginConnect((ar) => { if (ar.IsCompleted) { ((Microsoft.Lync.Model.Conversation.InstantMessageModality)ar.AsyncState).EndConnect(ar); } }, im);
        }
    }
    catch( Exception x )
    {
        //Handle exception
    }
}

This “sort-of” works, since it opens the contact window and starts a chat – meaning the other side is requested to join the chat.

Is there a way for me to open the Conversation Window without initiating the chat with the other user (I want it the same way as when I double click a user in the Lync contact list).

posted the same question at the Lync Client Dev. TechNet forum: http://lksz.me/s8Yn8a.

Thanks in advance.


My final result

Thanks to the answer provided by MOHAMED A. SAKAR and ckeller, I fixed my code, and here is my new method.
Thanks guys

The following using clause is needed:

using Microsoft.Lync.Model.Extensibility;

And here is the new code:

public static void StartChatWithUser(Microsoft.Lync.Model.Contact imContact, string title = null)
{
    try
    {
        var lyncAutomation = Microsoft.Lync.Model.LyncClient.GetAutomation();

        var inviteeList = new string[] { imContact.Uri };
        var modalitySettings = new Dictionary<AutomationModalitySettings, object>();
        modalitySettings.Add(AutomationModalitySettings.SendFirstInstantMessageImmediately, false);
        if (string.IsNullOrEmpty(title))
        {
            modalitySettings.Add(AutomationModalitySettings.Subject, title);
        }

        lyncAutomation.BeginStartConversation(
            AutomationModalities.InstantMessage,
            inviteeList,
            modalitySettings,
            (ar) => { if (ar.IsCompleted) { ((Automation)ar.AsyncState).EndStartConversation(ar); }},
            lyncAutomation);
    }
    catch( Exception x )
    {
        //Handle exception
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:54:08+00:00Added an answer on May 26, 2026 at 11:54 am

    you should first create Dictionary of AutomationModalitySettings and their values:

    private Dictionary<AutomationModalitySettings, object> _modalitySettings;
    

    After that you should initiate these modalities:

    _modalitySettings = new Dictionary<AutomationModalitySettings, object>();
    _modalitySettings.Add(AutomationModalitySettings.SendFirstInstantMessageImmediately, false);
    

    after that you could initiate the call

    _asyncResult = _automation.BeginStartConversation(
                 _chosenMode,
                 _inviteeList,
                 _modalitySettings,
                 null,
                 null);
    

    I hope this helps you

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So this seems pretty basic but I can't get it to work. I have
This seems like a pretty softball question, but I always have a hard time
This seems like a pretty basic thing to do but although I've been using
This seems like a pretty basic question but I unfortunately don't know the answer
This is a pretty basic question, but I can't seem to find it. It
this is a pretty basic question but I can't seem to get it right.
This seems like it should be pretty straight forward, but I'm apparently confused. I
This feels like it should be pretty simple, but not much seems to be
Im sure this is pretty simple but I just cant seem to find the
This is a pretty basic scenario but I'm not finding too many helpful resources.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.