UI抑制-客户端卡在SigningIn状态



我试图通过我的应用程序登录Skype For Business。

当我打开UI时,我可以登录。

当我设置UI Suppression时,我的客户端被困在状态中的签名处。凭据事件、SigninCallback事件和SignInDelayed事件均未激发。

你能帮我吗?

这是我的代码:

public void StartUpSkype()
{
try
{
_LyncClient = LyncClient.GetClient();
if (_LyncClient == null)
{
throw new Exception("Unable to obtain client interface");
}
if (_LyncClient.InSuppressedMode == true)
{
if (_LyncClient.State == ClientState.Uninitialized)
{
Object[] _asyncState = { _LyncClient };
_LyncClient.BeginInitialize(InitializeCallback, _asyncState);
}
}
_LyncClient.SignInDelayed += _LyncClient_SignInDelayed;
_LyncClient.StateChanged += _Client_ClientStateChanged;
_LyncClient.CredentialRequested += _LyncClient_CredentialRequested;
}
catch (NotStartedByUserException h)
{
DisplayErrorMessage("Lync is not running");
}
catch (Exception ex)
{
DisplayErrorMessage("General Exception");
}
}
void _Client_ClientStateChanged(Object source, ClientStateChangedEventArgs data)
{
if (data != null)
{
if (data.NewState == ClientState.SignedIn)
{
DisplayErrorMessage("Signed in");
UserIsSignedIn?.Invoke(_LyncClient);
}
if (data.NewState == ClientState.SignedOut)
{
string login = ConfigurationManager.AppSettings["loginSkypeClient"];
string password = ConfigurationManager.AppSettings["pwdSkypeClient"];
_LyncClient.SignInConfiguration.ForgetMe(login);
try
{
// starts the sign in process asynchronously
IAsyncResult asyncResult = _LyncClient.BeginSignIn(login, login, password, SigninCallback, _LyncClient);
// But wait for the results because the events cannot be registered within a worker thread.
asyncResult.AsyncWaitHandle.WaitOne();
}
catch (Exception e)
{
throw e;
}
}
}
}
void _LyncClient_CredentialRequested(object sender, CredentialRequestedEventArgs e)
{
string login = ConfigurationManager.AppSettings["loginSkypeClient"];
string password = ConfigurationManager.AppSettings["pwdSkypeClient"];
if (e.Type == CredentialRequestedType.SignIn)
{
e.Submit(login, password, false);
}
}
private void SigninCallback(IAsyncResult ar)
{
if (ar.IsCompleted == true)
{
try
{
((LyncClient)ar.AsyncState).EndSignIn(ar);
}
catch (RequestCanceledException re)
{
throw re;
}
}
}
private void InitializeCallback(IAsyncResult ar)
{
if (ar.IsCompleted == true)
{
object[] asyncState = (object[])ar.AsyncState;
((LyncClient)asyncState[0]).EndInitialize(ar);
//_ThisInitializedLync is part of application state and is 
//a class Boolean field that is set to true if this process
//initialized Lync.
_ThisInitializedLync = true;
}
}

登录+密码是正确的,因为我可以在UI打开时使用它们登录。

只有当UI被抑制时,问题才会出现。

我尝试过很多事情,现在我很绝望。

请检查SkypeForBusiness的版本。如果是2016年,那么这是由于在客户端和租户office365上都启用了ModernAuthentication。

在启用ModernAuthentication的情况下,LyncSDK不足以处理ModernAuth,因为SDK不支持,Microsoft也没有升级SDK的计划。

相关内容

  • 没有找到相关文章

最新更新