Hello there!
- I refactored code to connect to Dynamics by using the Oauth CRMServiceClient(<connectionstring>) method as explained here:
https://docs.microsoft.com/en-us/power-apps/developer/data-platform/authenticate-office365-deprecation - I also use early-bound classes generated by CrmSvcUtil/XrmToolbox as explained here:
https://docs.microsoft.com/en-us/power-apps/developer/data-platform/org-service/generate-early-bound-classes - However, when you use generated early-bound classes, you have to enable proxy types as explained here (see the green tip):
https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/developers-guide/gg328210(v=crm.8)?redirectedfrom=MSDN
Which means, the generated early bound class file has this attribute at the top:[assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()]
And in the connection code, I enabled proxy types (explained later). The problem is, EnableProxyTypes is a method that exists only in the OrganizationServiceProxy class--which is a class that is now forbidden by link #1 above.
Therefore, I must obtain a connected client using this:
var CrmSvc = new CrmServiceClient(<OauthConnectionString>);
However, I get this error:
A proxy type with the name <entity name> has been defined by another assembly
I could try adding the below lines that EnableProxyTypes, but they are forbidden by the documentation (link #1 above says not to use OrganizationServiceProxy):
CrmSvc.OrganizationServiceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior(Assembly.GetExecutingAssembly()));
CrmSvc.OrganizationServiceProxy.EnableProxyTypes(Assembly.GetExecutingAssembly());
So my question is, what is the correct way to enable proxy types (or in general, use early-bound generated classes), while complying with the removal of WS-Trust?
Thank you!