web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Unified interface forum
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Not able to connect Dynamics 365 Unified Interface by using “Microsoft.CrmSdk.XrmTooling.CoreAssembly” in C#

Posted on by 2,122

Hello,

We are trying to connect Dynamics 365 Unified Interface instance via C# code (WebAPI hosted at Azure) using Microsoft.CrmSdk.XrmTooling.CoreAssembly with the parameters ClinetId and ClinetSecrets. but we are getting below error.
"Unable to connect to CRM: Method not found: 'System.String Microsoft.Xrm.Sdk.Organization.OrganizationDetail.get_EnvironmentId()'.
Method not found: 'System.String Microsoft.Xrm.Sdk.Organization.OrganizationDetail.get_EnvironmentId()'.Unable to Login to Dynamics CRM
Unable to Login to Dynamics CRMOrganizationWebProxyClient is null
OrganizationWebProxyClient is null"
Please note, we have used latest Nuget version of "Microsoft.CrmSdk.XrmTooling.CoreAssembly" with the Framework 4.6.2.
Below is the code that we have written
        System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

        IOrganizationService organizationService = null;

        string organizationURI = "https://OrgName.api.crm.dynamics.com/XRMServices/2011/Organization.svc";
        string clientId = "Clientid";
        string clientSecret = "ClientSecret";

        var connection = new CrmServiceClient($@"AuthType=ClientSecret;url={organizationURI};ClientId={clientId};ClientSecret={clientSecret}");

        if (connection.IsReady)
        {
          organizationService = connection.OrganizationWebProxyClient != null ? connection.OrganizationWebProxyClient : (IOrganizationService)connection.OrganizationServiceProxy;
        }

Helpful resources

Leaderboard > User interface community

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans