User telephone number administration
Learn about the capabilities of the Lync 2013 API to let your application manage a Lync 2013 user’s telephone list, which includes adding a telephone number, changing a telephone number, publishing a telephone number on the contact card, and removing a number from the contact card.
Applies to: Lync 2013 | Lync Server 2013
Lync defines a set of four telephone number types that a user can add corresponding telephone numbers to. The Lync 2013 API exposes programmable types that let you create a telephone list administration interface in your application so that a user can create a list of telephone numbers where the user can be reached. Figure 1 shows a sample UI that lists the signed-in user’s telephone numbers. The text box, check box, and buttons on the right-hand side of the form let users change a telephone number, publish a number to their contact card, remove a number from their contact card, or remove a number from the list.
The following WPF form shows a list of user phone numbers on the upper left, a text box, a publish check box, a Save Edit button, a Remove button, and a presence indicator with a user’s full name.
Phone number administration is available through the Microsoft.Lync.Model.Self class. The Self class encapsulates the user who is currently signed in to Lync 2013. Self exposes the properties, methods, and events that are used to fill the telephone list on the sample, keep the list up to date when a user changes a telephone number with the Lync 2013 client, and start telephone list update operations. Other publishable contact card information such as personal notes, availability, display photo URLs, and location names are also published by calling methods on the Self class.
For information about how to create a telephone administration UI, see How to: Update and publish user telephone numbers in Lync SDK.
Contact card telephone numbers
The signed-in user is represented by the Self class and is represented by a Microsoft.Lync.Model.Contact object obtained from the Self.Contact property. This Contact object exposes a collection of telephone numbers for the local user and an event that is raised when the collection changes. The telephone number list that you get from the Self class might not be identical to the telephone number list you get from the Contact class for the same user. This is because the telephone number collection on the Self class includes telephone numbers that are not published on the user’s contact card. The telephone number list from the Contact object includes only numbers that are published on the contact card. If a user has entered a telephone number for each of the four telephone number types, but has published none of the numbers to the contact card, the Contact telephone number collection is empty while the Self telephone number collection has four telephone numbers.
The contact card telephone number list is a list of all endpoints that a user can be reached on. This list includes the ContactEndpointType.Lync and ContactEndpointType.VoiceMail. These two types cannot be published or edited. For this reason, the types are not available from the Self class.
The Contact object telephone list is used to populate a contact card in your application UI. You cannot update a user’s telephone numbers by using the Contact object. You must use the Self object to update or publish telephone numbers to the user’s contact card.