Answered by:
Not able to connect to MS Dymics CRM discovery service

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- Proposed as answer by Ranjitsingh R Saturday, August 7, 2010 4:26 AM
- Marked as answer by DavidJennawayMVP, Moderator Thursday, August 26, 2010 3:38 PM
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;
- Merged by DavidJennawayMVP, Moderator Monday, August 2, 2010 10:22 AM Duplicate thread
Monday, August 2, 2010 7:03 AM -
Monday, August 2, 2010 7:18 AMModerator
-
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 RepositoryMonday, August 2, 2010 9:46 AMModerator -
have you tried using NetworkCredential?
discoveryService.Credentials = new System.Net.NetworkCredential(<<username>>, <<password>, <<domain>>);
MayankP My Blog My twitterThursday, 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.comThursday, August 5, 2010 6:42 PMModerator -
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- Proposed as answer by Ranjitsingh R Saturday, August 7, 2010 4:26 AM
- Marked as answer by DavidJennawayMVP, Moderator Thursday, August 26, 2010 3:38 PM
Saturday, August 7, 2010 4:26 AM