Sunday, June 25, 2017

CRM 365 Online - Discovery Service

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


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:

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.




Asp.Net MVC (5) - Exception Filter - HandleError

Applicable on Asp.Net MVC5 HandleError Filter This belongs to Exception Filters category (Authentication Filter, Authoriz...