OrganizationServiceProxy and DefaultCredentials RRS feed

  • Question

  • Hi,

    The SDK console examples requires the user to provide his/her password manually when authentication to MS CRM.

    I would like to authenticate using AD, but without requiring the user to provide their password manually:

    In MS CRM 4.0 this would typically have been:

                CrmService crmserv = new CrmService();
                service.Url = "http://<servername>:5555/mscrmservices/2007/crmservice.asmx";
                crmserv.CrmAuthenticationTokenValue = token;
                crmserv.Credentials =System.Net.CredentialCache.DefaultCredentials;
                return crmserv;

    I cannot pass across the DefaultCredentials as usercredentials when instantiating the userCredentials parameter.

    using (OrganizationServiceProxy _serviceProxy = new OrganizationServiceProxy(organizationUri, homeRealmUri, userCredentials, deviceCredentials))


    Monday, September 2, 2013 12:28 PM

All replies

  • Hi,
    try with this code:

    Uri uri = new Uri("https://server/organization/XRMServices/2011/Organization.svc");
    ClientCredentials clientCredential = new ClientCredentials();
    clientCredential.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
    OrganizationServiceProxy organizationServiceProxy = new OrganizationServiceProxy(uri, null, clientCredential, null);

    My blog: www.crmanswers.net

    Monday, September 2, 2013 12:35 PM