locked
Create an organization service by taking windows credentials, MS CRM 2013 RRS feed

  • Question

  • Hi,

    I have created a windows form application. On load of my application, i want to retrieve some information from online CRM 2013 and use in my application.

    So my intention is to create an organization service object by taking windows (AD) credentials. CRM credentials are same as the windows credentials in our company. Any help how could i create an organization  service using windows credentials ?

    Wednesday, May 28, 2014 9:59 AM

All replies

  • Hi,

    When you instantiate the ClientCredentials, use DefaultNetworkCredentials. The following code should do the work:

    IOrganizationService orgService = null;
    
    ClientCredentials credentials = new ClientCredentials();
    credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
    
    Uri serviceUri = new Uri("http://mycrm:5555/MyOrg/XRMServices/2011/Organization.svc");
    
    OrganizationServiceProxy orgServiceProxy = new OrganizationServiceProxy(serviceUri, null, credentials, null);
    orgServiceProxy.EnableProxyTypes();
    
    orgService = (IOrganizationService)orgServiceProxy;

    Make sure you replace the Uri with that of your CRM Server URL.


    Admin QuikView Solution for CRM 2013



    Wednesday, May 28, 2014 10:36 AM
  • If you download the CRM 2013 SDK, there is a section Sample: Authenticate users with Microsoft Dynamics CRM web services, that can help you with the authentication.
    Wednesday, May 28, 2014 6:24 PM