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

5

CRM 论坛上的某个人告诉我该怎么做:

credentials.ClientCredentials.SupportInteractive = false;

于 2013-10-18T12:35:47.637 回答