Example #1
0
 /// <summary>
 /// Raised when user's credentials are rejected by Lync or a service that
 /// Lync depends on requests credentials
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void _LyncClient_CredentialRequested(object sender, CredentialRequestedEventArgs e)
 {
     //If the request for credentials comes from Lync server then sign out, get new creentials
     //and sign in.
     if (e.Type == CredentialRequestedType.LyncAutodiscover)
     {
         try
         {
             _LyncClient.BeginSignOut((ar) =>
             {
                 _LyncClient.EndSignOut(ar);
                 //Ask user for credentials and attempt to sign in again
                 SignUserIn();
             }, null);
         }
         catch (Exception ex)
         {
             if (SetWindowCursor != null)
             {
                 SetWindowCursor(Cursors.Arrow);
             }
             MessageBox.Show(
                 "Exception on attempt to sign in, abandoning sign in: " +
                 ex.Message,
                 "Lync Client sign in delay",
                 MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         e.Submit(Constants.ID, Constants.PASSWORD, false);
     }
 }
 /// <summary>
 /// Raised when user's credentials are rejected by Lync or a service that
 /// Lync depends on requests credentials
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void _LyncClient_CredentialRequested(object sender, CredentialRequestedEventArgs e)
 {
     //If the request for credentials comes from Lync server then sign out, get new creentials
     //and sign in.
     if (e.Type == CredentialRequestedType.LyncAutodiscover)
     {
         try
         {
             _LyncClient.BeginSignOut((ar) =>
             {
                 _LyncClient.EndSignOut(ar);
                 //Ask user for credentials and attempt to sign in again
                 SignUserIn();
             }, null);
         }
         catch (Exception ex)
         {
             if (SetWindowCursor != null)
             {
                 SetWindowCursor(Cursors.Arrow);
             }
             MessageBox.Show(
                 "Exception on attempt to sign in, abandoning sign in: " +
                 ex.Message,
                 "Lync Client sign in delay",
                 MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         SignInCreds getCreds;
         getCreds = new SignInCreds(e.Type.ToString());
         if (getCreds.ShowDialog() == DialogResult.OK)
         {
             string userUri      = getCreds.UserName;
             string userPassword = getCreds.Password;
             getCreds.Close();
             e.Submit(userUri, userPassword, false);
         }
     }
 }