Exercise 1: Using Lync Controls in a WPF Application

Task 1 – Beginning the Lab

In this task, you will open the project and configure it to run with your accounts.

  1. Navigate to Start >> All Programs >> Microsoft Visual Studio 2010.
  2. Click on the Microsoft Visual Studio 2010 icon to start Visual Studio 2010.
  3. Select File >> Open Project.
  4. Navigate to the folder C:\%UC14TrainingKit%\Labs\2\Source\Before\LyncControls_UsingControls.
  5. Open the LyncControls_UsingControls project.
  6. In Solution Explorer, open the app.config file.
  7. Change the PrimaryLabUserId and SecondaryLabUserId values to the SIP URI of your primary and secondary lab accounts (i.e. sip:sc@fabrikam.com).
  8. Open Window1.xaml.cs.
  9. Select View >> Task List and select Comments from the menu.
  10. Open Microsoft Lync 2010 and add the secondary lab account user as a contact.
  11. Start a remote desktop session as the secondary lab user or log in to the secondary lab user’s computer.
  12. Open Lync 2010 and add the primary lab account user as a contact.
  13. Return to the primary lab user’s desktop.

Task 2 – Adding Lync Controls

In this task, you will bind the Source property of the Lync Controls to the SIP address of the secondary lab user.

  1. Double click TODO: 2.1.1.
  2. Add the following code after the TODO: 2.1.1 comment. This sets the source property of each Lync Control to bind them to a contact.

    C#

  3. Go to Debug >> Start Without Debugging or use the shortcut key combination by pressing [Ctrl]+[F5] to start the application.
  4. Click on the StartInstantMessagingButton button next to the secondary lab user to start an IM conversation.

  5. Enter “Hello” into the conversation window and press the Enter key.
  6. Switch to the secondary lab user’s desktop and check that the IM was received.
  7. Close the application and the IM windows.

Task 3 – Displaying the Contact List

In this task, you will add a ContactList control in XAML and show that it is connected to the user’s contact list in Lync 2010.

  1. Open the Window1.xaml file.
  2. Find the text “TODO: 2.1.2” by pressing [Ctrl]+[F].
  3. Add the following code after the TODO: 2.1.2 comment. This adds the ContactList control.

    XAML

  4. Press [Ctrl]+[F5] to start the application.
  5. Open Lync 2010.
  6. In the ContactList of the application, right-click the secondary lab user contact and select Remove from Contact List.

  7. Confirm that the contact was removed from the Lync 2010 contact list.

  8. Close the application.

Task 4 – Searching for Contacts and Displaying the Results

In this task, you will add the ContactSearch to the application to search for contacts.

  1. Open the Window1.xaml file.
  2. Find the text “TODO: 2.1.3” by pressing [Ctrl]+[F].
  3. Add the following code after the TODO: 2.1.3 comment. This integrates Lync’s Search functionality into the application.

    XAML

  4. Remove the secondary lab user from the contact list in Lync 2010 by selecting the contact in the contact list, right-clicking the contact and selecting Remove from Contact List.
  5. Press [Ctrl]+[F5] to start the application.
  6. Type the secondary lab user’s name into the search field.
  7. When the contact is displayed, right-click the contact card beneath the search field and select Copy Contact To >> Other Contacts.

  8. The new contact should be displayed in the ContactList of both the application and Lync 2010.
  9. Close the application.

Task 5 – Displaying a Custom Contact List

In this task, you will display multiple Lync contacts in a CustomContactList.

  1. Double click TODO: 2.1.4 in the task list.
  2. Add the following code after the TODO: 2.1.4 comment. This binds the CustomContactList control to a list of SIP addresses. These users do not have to be contacts in Lync — they can be any contacts in the organization.

    C#

  3. Press [Ctrl]+[F5] to start the application.
  4. Locate your secondary lab user at the top of the CustomContactList and press the Call button.

  5. An audio conversation will be started.
  6. Close the application.
Note:
The SIP addresses above will need to be replaced with valid SIP addresses in your Microsoft Lync Server 2010 deployment.