The CrmServiceClient class is a key component of the Xrm Tooling library. This class has two important properties that, as a developer, you may have probably used in many instances: OrganizationServiceProxy and OrganizationWebProxyClient . Depending on the authentication type, these objects may be null. This article explains some of these cases.
Let’s have a look at this code:
In this case, using the Office365 authentication type, we have that the OrganizationServiceProxy is not null, but OrganizationWebProxyClient is null.
Now the important news, you must NOT use OrganizationServiceProxy any more in your new implementations. The reason for this is that the authetication type “Office365” has been deprecated:
Effective February 4, 2020, the WS-Trust authentication type that is used by custom clients to connect to Common Data Service is deprecated. This change affects applications that utilize Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy and Microsoft.Xrm.Tooling.Connector.CrmServiceClient classes for the authentication type of “Office365”https://docs.microsoft.com/en-us/power-platform/important-changes-coming#deprecation-of-office365-authentication-type-and-organizationserviceproxy-class-for-connecting-to-common-data-service
What authentication types should I use? You should use “ClientSecret” or “OAuth” instead. Let’s have a look at these examples:
In this other scenario where we are using the Client Secret authentication, we got the opposite, OrganizationServiceProxy is null, but OrganizationWebProxyClient is not null.
The same happens using OAuth:
These are three of the most common authentication types used for online deployments. However, there are a few more types, see the common data service connection strings documentation.
The following table sumarise the cases we have discussed above. What about the rest? I’ll wait for your feedback 🙂
- Some of the points described in this article are not something new. James Wood (@sirjameswood) already published a good article in the past covering the same topic.
- At the time of writing this article, I’m using the package Microsoft.CrmSdk.XrmTooling.CoreAssembly 220.127.116.11 and I’m connecting to an environment whose version is 18.104.22.16844 with 2020 release wave 1 enabled