2

現在、次のようにCRM SDKにアクセスしています

IServiceManagement<IDiscoveryService> serviceManagement =
                        ServiceConfigurationFactory.CreateManagement<IDiscoveryService>(discoveryUri);
ClientCredentials credentials = new ClientCredentials();
credentials.Windows.ClientCredential = new System.Net.NetworkCredential(userName, password, domain);
using (DiscoveryServiceProxy serviceProxy = new DiscoveryServiceProxy(new DiscoveryServiceProxy(serviceManagement, credentials))
{
    RetrieveOrganizationsRequest orgRequest = new RetrieveOrganizationsRequest();
    RetrieveOrganizationsResponse orgResponse =
                (RetrieveOrganizationsResponse)service.Execute(orgRequest);
    // do something with organisations
}

ただし、ドメイン クレデンシャルが正しくない場合は、Windowsログイン プロンプトが表示されます( のどこかにservice.Execute)。そのログインプロンプトは必要ありません。PrincipalContextに渡す前に を使用して資格情報を検証することで、この問題を回避しましたDiscoveryServiceProxyが、完全に満足しているわけではありません。

ログインプロンプトを無効にする方法はありますか?

4

1 に答える 1