Walkthrough: Share a Screen with Another User (Lync 2010 SDK)
This topic shows how to share a monitor screen in a conversation using .NET Framework managed code with Microsoft Lync 2010 SDK.
Prerequisites
For a list of prerequisites, see Walkthrough: Start an Instant Message Conversation (Lync 2010 SDK).
Creating the Screen Sharing Application
To create the screen sharing application
Sign in to Microsoft Lync 2010.
In Microsoft Visual Studio development system, create a new Microsoft Windows Forms application.
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.
Add a reference to Microsoft.Lync.Model.
In Form1.cs, add the following using statement.
using Microsoft.Lync.Model; using Microsoft.Lync.Model.Extensibility;
In the Form1_Load event handler add the following code.
// This variable will contain the conversation mode enumeration. private AutomationModalities _ChosenMode = AutomationModalities.InstantMessage; // Create a dictionary object to contain AutomationModalitySettings data pairs. Dictionary<AutomationModalitySettings, object> _ModalitySettings = new Dictionary<AutomationModalitySettings, object>(); // Get the Automation object. Automation _Automation = LyncClient.GetAutomation(); // Set the conversation modes of application sharing and instant messaging. _ChosenMode = AutomationModalities.ApplicationSharing | AutomationModalities.InstantMessage; // Set the LAST monitor screen as the application sharing resource. _ModalitySettings.Add(AutomationModalitySettings.SharedMonitor, SystemInformation.MonitorCount); // Adds text to toast and local user IMWindow text-entry control. _ModalitySettings.Add(AutomationModalitySettings.FirstInstantMessage, "Hello Elise. I would like to share my second monitor screen with you."); _ModalitySettings.Add(AutomationModalitySettings.SendFirstInstantMessageImmediately, true); // Create a generic List object to contain a contact URI. List<string> invitees = new List<string>(); // Edit this to provide a valid contact URI. invitees.Add("elise@contoso.com"); // Start the conversation. IAsyncResult ar = _Automation.BeginStartConversation( _ChosenMode , invitees , _ModalitySettings , null , null); _Automation.EndStartConversation(ar);
Build and run the application. After the invited user accepts the share desktop request, the local computer desktop appears in the remote Microsoft Lync 2010 conversation window.
See Also
Other Resources
Lync Extensibility API Conversation Walkthroughs (Lync 2010 SDK)