Lync Server sign-in configuration

Lync 2013

Beyond the basics topic

Learn how to configure Lync Server 2013 sign-in settings using the Lync 2013 API to create a custom sign-in settings dialog box in your application and clear the sign-in credential cache.

Last modified: January 10, 2013

Applies to: Lync 2013 | Lync Server 2013

Server sign-in settings let you set different URL strings for Lync Server 2013 registration servers before a user attempts to sign in to Lync 2013. This gives you the flexibility to programmatically sign a user in to different server topologies depending on current requirements. In addition to letting you set server URL strings and auto-discovery mode, you can read other configuration settings such as password saving mode, intranet sign-in status, sign-in auto-retry status, and the user name string of the currently signed-in user. The SigninConfiguration class exposes properties that provide the values for these settings.

Figure 1 shows an example Windows Form that lets a user set and read the properties of the SigninConfiguration class before the user signs in to a Lync topology. The Windows Form provides radio button choices for both password saving and transport protocol.

Important note Important

The SigninConfiguration class exposes transport protocol and password saving mode settings as read-write properties but the Lync client does not let you set these two settings programmatically.

Figure 1. Sample sign-in configuration settings UI

Sign in configuration dialog sample UI

The Mode choices in figure 1 let you turn server auto-discovery on or off. When auto-discovery is turned on, any URL strings that you enter for an internal server URL or external server URL are ignored when signing a user in. Instead, Lync parses the user name string for the domain of a registration server. When the domain is identified, the registration server URL is auto-discovered and the user is signed in to that registration server.

If the computer that your application is running on is outside an organization’s Lync Server 2013 topology, a user is signed in to Lync through an Edge server. The external URL string is the URL of the Edge server.

Getting the current sign-in settings

The Lync 2013 API does not expose an event to be raised when sign-in configuration settings are changed. To show current settings in your application, you must either poll for changes by reading properties on SigninConfiguration or read the properties on a UI event such as the clicking of a button or opening the UI form itself.

Lync 2013 caches the SIP address, user name, and password of every user who successfully signs in to Lync 2013 on a local computer. This allows the program to sign the previous user in to Lync again without requiring the user to enter their credentials. Lync 2013 stores credentials for multiple users. Individual users can select to make Lync 2013 clear the credential cache of their credentials by clicking the Delete my sign-in info link on the main Lync 2013 window before they sign in.

The Lync 2013 API exposes a method on the Microsoft.Lync.Model.SignInConfiguration class that removes the cached credentials of the user specified by the SIP address parameter. When the credentials are removed, the user must supply credentials to sign in again.

The following example checks to see whether the client is signed out, removes the ″sip:″ substring from a SIP address obtained from a Microsoft.Lync.Model.Contact object, and then calls the SignInConfiguration.ForgetMe method.

        /// <summary>
        /// Clears the credential cache of the credentials of a user
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ForgetMeButton_Click_1(object sender, RoutedEventArgs e)
            //The Lync client must be signed out when the ForgetMe method is called
            if (lyncClient.State != ClientState.SignedOut)
                //Strips "sip:" out of the string obtained from the Contact.Uri property
                userSIPUri = userSIPUri.Replace("sip:", " ");
                userSIPUri = userSIPUri.Trim();
            catch (LyncClientException lce)
                MessageBox.Show("Lync client exception on ForgetMe call " + lce.Message);