Update 18-Nov-2016: Bugs reported have been fixed and there are no compelling reasons (beyond the support of the existing codebase) to continue use of Microsoft.Xrm.Client.
One thing you’d notice about Dynamics CRM 2016 SDK is that some of the assemblies has gone MIA. For example, Microsoft.Xrm.Client, a home to some useful developers extensions, including a mighty CrmConnection class, is nowhere to be found. These extensions were taken over by Xrm Tooling family, the one we mentioned before.
CrmServiceClient, in particular, looks like a solid replacement for CrmConnection but, as with any new libraries, there are few gotchas.
This is the only connection string that worked for us so far in non-interactive mode:
CrmServiceClient conn = new CrmServiceClient( "ServiceUri=https://orgname.contoso.com/orgname;" + "AuthType=IFD;Domain=anything;" + "UserNameemail@example.com;Password=pass@word1;" + "LoginPrompt=Never;");
Note the following:
- Url must be in the form of https://orgname.contoso.com/orgname. For on-premises and IFD deployments the connector expects orgname to be at the end and looks like it does not make any attempt to deduce orgname from the server url.
- Domain name must be specified but it’s not passed via claims, so it can be anything. Really any non-empty string o__O
- Username must be UPN. If it’s not, then, since domain name is not passed it, ADFS 3.0 throws a fit (ADFS 2.0 assumes the domain)
The following syntax works as well:
CrmServiceClient conn = new CrmServiceClient( new System.Net.NetworkCredential( "firstname.lastname@example.org", "pass@word1"), AuthenticationType.IFD, "orgname.contoso.com", "443", "orgname", useSsl: true);
Same restrictions apply except that there is no need to specify the dummy domain name.
Whilst we manage to get CrmServiceClient working for non-interactive IFD connections, we’re heard from reliable sources that it does not work currently in Azure Web Apps / App Service Web Apps while attempting to connect to CRM Online.
The workaround? You can still use the bits from CRM 2015 SDK and its very reliable CrmConnection class – just make sure to load the other Nuget packages for CRM 2016 first and then add Microsoft.Xrm.Client.
What would the connection string look like for a CRM Online organization?
Hi ,not sure it is exaggerated to be honest. The introduction of Web API is here to replace the existing Organization Service and SOAP endpoints completely. So from Dynamics 365 onwards at least it is truly dead. Talked about it here: http://antonyellisdynamicscrm.wordpress.com/2017/02/20/dynamics-365-crm-sdk-version-comparisons/
you’re quite right and we’ve expressed our condolences since then in a new tip #777.
Nice table in your post, btw, though not sure what’s the story with Microsoft.Xrm.Tooling.Ui.Resources.dll?
Thanks George, I have updated the post since and wrote about the seemingly ocean of ways to connect to CRM too depending on assembly choices along with Dynamics 365 Web API changes (https://antonyellisdynamicscrm.wordpress.com/2017/02/22/connecting-to-dynamics-365-and-earlier-crm-versions/). Concerning Microsoft.Tooling.Ui.Resources.dll they removed the assembly and refactored the functionality into the Microsoft.Tooling.Ui.Styles.dll!! Nice one Microsoft!