Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

Is it possible to use current windows user credentials for new OrganizationServiceProxy connection to Dynamics 365 instance?

$
0
0

Is it possible to use current windows user credentials for new OrganizationServiceProxy connection to Dynamics 365 instance?

ClientCredentials credentials = new ClientCredentials();
//credentials.UserName.UserName = username;
//credentials.UserName.Password = password;

Uri organizationUri = new Uri(serviceUrl);
Uri homeRealmUri = null;

// set default credentials for OrganizationService
credentials.Windows.ClientCredential = (NetworkCredential)CredentialCache.DefaultCredentials;
// or
//credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;

OrganizationProxy = new OrganizationServiceProxy(organizationUri, homeRealmUri, credentials, null);

However this throws this:

System.ArgumentNullException: Value cannot be null.
Parameter name: ClientCredentials.UserName.UserName


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>