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.
- Navigate to Start >> All Programs >> Microsoft Visual Studio 2010.
- Click on the Microsoft Visual Studio 2010 icon to start Visual Studio 2010.
- Select File >> Open Project.
- Navigate to the folder C:\%UC14TrainingKit%\Labs\2\Source\Before\LyncControls_UsingControls.
- Open the LyncControls_UsingControls project.
- In Solution Explorer, open the app.config file.
- Change the PrimaryLabUserId and SecondaryLabUserId values to the SIP URI of your primary and secondary lab accounts (i.e. sip:sc@fabrikam.com).
- Open Window1.xaml.cs.
- Select View >> Task List and select Comments from the menu.
- Open Microsoft Lync 2010 and add the secondary lab account user as a contact.
- Start a remote desktop session as the secondary lab user or log in to the secondary lab user’s computer.
- Open Lync 2010 and add the primary lab account user as a contact.
- 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.
- Double click TODO: 2.1.1.
- 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.
- Go to Debug >> Start Without Debugging or use the shortcut key combination by pressing [Ctrl]+[F5] to start the application.
- Click on the StartInstantMessagingButton button next to the secondary lab user to start an IM conversation.
- Enter “Hello” into the conversation window and press the Enter key.
- Switch to the secondary lab user’s desktop and check that the IM was received.
- 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.
- Open the Window1.xaml file.
- Find the text “TODO: 2.1.2” by pressing [Ctrl]+[F].
- Add the following code after the TODO: 2.1.2 comment. This adds the ContactList control.
- Press [Ctrl]+[F5] to start the application.
- Open Lync 2010.
- In the ContactList of the application, right-click the secondary lab user contact and select Remove from Contact List.
- Confirm that the contact was removed from the Lync 2010 contact list.
- 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.
- Open the Window1.xaml file.
- Find the text “TODO: 2.1.3” by pressing [Ctrl]+[F].
- Add the following code after the TODO: 2.1.3 comment. This integrates Lync’s Search functionality into the application.
- 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.
- Press [Ctrl]+[F5] to start the application.
- Type the secondary lab user’s name into the search field.
- When the contact is displayed, right-click the contact card beneath the search field and select Copy Contact To >> Other Contacts.
- The new contact should be displayed in the ContactList of both the application and Lync 2010.
- Close the application.
Task 5 – Displaying a Custom Contact List
In this task, you will display multiple Lync contacts in a CustomContactList.
- Double click TODO: 2.1.4 in the task list.
- 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.
- Press [Ctrl]+[F5] to start the application.
- Locate your secondary lab user at the top of the CustomContactList and press the Call button.
- An audio conversation will be started.
- Close the application.
The SIP addresses above will need to be replaced with valid SIP addresses in your Microsoft Lync Server 2010 deployment.