Walkthrough: Share a Desktop with Another User (Lync 2010 SDK)

This topic shows how to share a desktop in a conversation by using .NET Framework managed code with Microsoft Lync 2010 SDK.

To create the desktop sharing application

  1. Sign in to Microsoft Lync 2010.

  2. In Microsoft Visual Studio development system, create a new Windows Forms application.

  3. Select .NET Framework 3.5 or 4.0 as the target framework. For more information, see How to: Target a Specific .NET Framework Version or Profile.

  4. Add a reference to Microsoft.Lync.Model.

  5. In Form1.cs add the following using statement.

    using Microsoft.Lync.Model;
    using Microsoft.Lync.Model.Extensibility;
  6. In the Form1_Load event handler add the following code.

    // Create a dictionary object to contain AutomationModalitySettings data pairs. 
    Dictionary<AutomationModalitySettings, object> _ModalitySettings = new Dictionary<AutomationModalitySettings, object>();
    AutomationModalities _ChosenMode = AutomationModalities.ApplicationSharing | AutomationModalities.InstantMessage;
    // Get the Automation object.
    Automation _Automation = LyncClient.GetAutomation();
    // Specify that the desktop is to be shared.
    _ModalitySettings.Add(AutomationModalitySettings.SharedDesktop, 0);
    // Adds text to toast and local user IMWindow text-entry control.
    _ModalitySettings.Add(AutomationModalitySettings.FirstInstantMessage, "Hello Elise. I would like to share my desktop with you.");
    _ModalitySettings.Add(AutomationModalitySettings.SendFirstInstantMessageImmediately, true);
    // Create a generic List object to contain a contact URI.
    List<string> myInviteeList = new List<string>();
    // Edit value to provide a valid contact URI.
    // Start the conversation.
    IAsyncResult ar = myUIAuto.BeginStartConversation(
  7. Build and run the application. After the invited user accepts the desktop sharing request, the local computer desktop appears within the remote Lync 2010 conversation window.