This topic demonstrates how to share a display monitor in a conversation using .NET managed code with Microsoft Lync 2010 SDK.


For a list of prerequisites, see Walkthrough: Start an Instant Message Conversation .

Creating the Display Monitor Sharing Application

To create the monitor 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 the MSDN topic How to: Target a Specific .NET Framework.

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

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

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

      Copy imageCopy Code
    // This variable will contain the conversation mode enumeration.
    private AutomationModalities _ChosenMode =
    // Create a dictionary object to contain AutomationModalitySettings
    data pairs. 
    Dictionary<AutomationModalitySettings, object>
    _ModalitySettings = new Dictionary<AutomationModalitySettings,
    // Get the Automation object.
    Automation _Automation = LyncClient.GetAutomation();
    // Set the conversation modes of application sharing and instant
    _ChosenMode = AutomationModalities.ApplicationSharing |
    // Set the LAST display monitor as the application sharing
    //Adds text to toast and local user IMWindow text entry control.
    "Hello Elise. I would like to share my second monitor with you.");
    // Create a generic List object to contain a contact URI.
    List<string> invitees = new List<string>();
    // Edit this to provide a valid contact URI.
    // Start the conversation.
    IAsyncResult ar =  _Automation.BeginStartConversation(
    	, invitees
    	, _ModalitySettings
    	, null
    	, null);
  7. Build and run the application. After the invited user accepts the desktop sharing request, the local machine's desktop is displayed within the remote Microsoft Lync 2010 conversation window .

See Also

Other Resources