locked
Not able to connect to MS Dymics CRM discovery service RRS feed

  • Question

  • Not able to connect to MS Dymics CRM discovery service

    eventhough i given the property

    discoveryService.UseDefaultCredentials =

    true;

    Plese help me regarding authentication problems.

     

    Monday, August 2, 2010 7:01 AM

Answers

  • Try using below code: FROM SDK

    [C#]
    // Provide valid Microsoft Dynamics CRM server information.
    string hostname = "localhost";
    string port = "80";

    // Create the discovery service.
    CrmDiscoveryService discoveryService = new CrmDiscoveryService();

    // Set the discovery service properties.
    discoveryService.UseDefaultCredentials = true;
    discoveryService.Url = String.Format("http://{0}:{1}/MSCRMServices/2007/{2}/CrmDiscoveryService.asmx", hostname, port, "AD");

    // Retrieve the organization name and endpoint URL from the CrmDiscoveryService Web service.
    RetrieveOrganizationsRequest orgRequest = new RetrieveOrganizationsRequest();
    RetrieveOrganizationsResponse orgResponse = (RetrieveOrganizationsResponse)discoveryService.Execute(orgRequest);

    OrganizationDetail orgInfo = null;

    // Iterate through all the retrieved organizations.
    foreach (OrganizationDetail orgDetail in orgResponse.OrganizationDetails)
    {
                        if (orgDetail.FriendlyName.Equals(orgFriendlyName))
    {
    orgInfo = orgDetail;
    break;
    }
    }

    if (orgInfo == null)
    {
                      throw new Exception("The organization name is invalid.");
    }
     

     Hope this helps.


    Thanks, Ranjitsingh R | http://mscrm-developer.blogspot.com/ | MS CRM Consultant
    Saturday, August 7, 2010 4:26 AM

All replies

  •  Not able to connect to MS Dymics CRM discovery service

    i given the below property

    discoveryService.UseDefaultCredentials =

    true;

    Monday, August 2, 2010 7:03 AM
  • could you paste your full code here ???

    Mahain : http://mahenderpal.wordpress.com
    Monday, August 2, 2010 7:18 AM
    Moderator
  • Post the whole code for connecting to that service, please

     


    My blog : http://mscrmtools.blogspot.com

    All my tools on my new dedicated site: MSCRMTools Repository
    Monday, August 2, 2010 9:46 AM
    Moderator
  • have you tried using NetworkCredential?

    discoveryService.Credentials = new System.Net.NetworkCredential(<<username>>, <<password>, <<domain>>);

     


    MayankP My Blog My twitter
    Thursday, August 5, 2010 4:38 PM
  • If you use split-server roles, know that the "Discovery Service" role is not installed on the "Application Server" by default, and instead only available on the "Platform Server".  You would need to use a customized installation script to deploy this role to the "Application Server".

    However, if that does not apply to your situation, then full disclosure of the error you're receiving, and relevant code will be most useful in diagnosing the problem.


    Dave Berry - MVP Dynamics CRM - http:\\crmentropy.blogspot.com
    Thursday, August 5, 2010 6:42 PM
    Moderator
  • Try using below code: FROM SDK

    [C#]
    // Provide valid Microsoft Dynamics CRM server information.
    string hostname = "localhost";
    string port = "80";

    // Create the discovery service.
    CrmDiscoveryService discoveryService = new CrmDiscoveryService();

    // Set the discovery service properties.
    discoveryService.UseDefaultCredentials = true;
    discoveryService.Url = String.Format("http://{0}:{1}/MSCRMServices/2007/{2}/CrmDiscoveryService.asmx", hostname, port, "AD");

    // Retrieve the organization name and endpoint URL from the CrmDiscoveryService Web service.
    RetrieveOrganizationsRequest orgRequest = new RetrieveOrganizationsRequest();
    RetrieveOrganizationsResponse orgResponse = (RetrieveOrganizationsResponse)discoveryService.Execute(orgRequest);

    OrganizationDetail orgInfo = null;

    // Iterate through all the retrieved organizations.
    foreach (OrganizationDetail orgDetail in orgResponse.OrganizationDetails)
    {
                        if (orgDetail.FriendlyName.Equals(orgFriendlyName))
    {
    orgInfo = orgDetail;
    break;
    }
    }

    if (orgInfo == null)
    {
                      throw new Exception("The organization name is invalid.");
    }
     

     Hope this helps.


    Thanks, Ranjitsingh R | http://mscrm-developer.blogspot.com/ | MS CRM Consultant
    Saturday, August 7, 2010 4:26 AM