Hi,
Today I was writing code in order to use CRM Discovery Service to retrieve my CRM organizations list for Dynamics 365 Online. To find out Web Application URL (CRM Application Url), Organization Service Url and Organization data service URL
Casting Error of DiscoveryServiceProxy in CRM 365 Online
Problem Solution:
To solve Discovery Service Proxy casting error on Dynamics 365, I have used Microsoft.Xrm.Tooling.Connector
I tried using Microsoft.Xrm.Sdk.Client.DiscoveryServiceProxy as used to do in previous versions of CRM (Online / On-Premises). Every thing works fine but when the program reached at line where DiscoveryResponse object is casted to its derived class RetrieveOrganizationsResponse, program throw exception as shown.
So, Microsoft.Xrm.Sdk.Client.DiscoveryServiceProxy is giving cast error. However when the code is debugged it successfully cast without any error as shown below
Today I was writing code in order to use CRM Discovery Service to retrieve my CRM organizations list for Dynamics 365 Online. To find out Web Application URL (CRM Application Url), Organization Service Url and Organization data service URL
Casting Error of DiscoveryServiceProxy in CRM 365 Online
Problem Solution:
To solve Discovery Service Proxy casting error on Dynamics 365, I have used Microsoft.Xrm.Tooling.Connector
Below is the solution code.
OrganizationDetailCollection orgDet = Microsoft.Xrm.Tooling.Connector.CrmServiceClient.DiscoverOrganizations(CRMService.DiscoveryUri, null, CRMService.CRMcredentials, null);
Debug.Write(orgDet[0].Endpoints[EndpointType.OrganizationService]);
Explanation:
㉺㉼㉴㉳㉽㉾㈕㈔㈆㈅㈄㈄㈃㈁㈀㉤
Ali Hamza Wadood
Microsoft Dynamics CRM Developer | Software Engineer - Microsoft Technologies(Asp.Net, Asp.Net MVC)
LinkedIn
Ali Hamza Wadood
Microsoft Dynamics CRM Developer | Software Engineer - Microsoft Technologies(Asp.Net, Asp.Net MVC)