My client is using On-Premise D365.
I need to connect with it using the SDK. Unfortunately the service returned is always null.
This is the code I have tried out.
private IOrganizationService GetService()
{
IOrganizationService service = null;
string value = System.Configuration.ConfigurationSettings.AppSettings["CRMConnectionString"];
CrmServiceClient conn = new Microsoft.Xrm.Tooling.Connector.CrmServiceClient(value);
return (IOrganizationService)((conn.OrganizationWebProxyClient != null) ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy);
}
The Connection string is like the following
<connectionStrings>
<add name="CRMConnectionString" connectionString="AuthType=AD;Url=">contoso:8080/Test;" />
</connectionStrings>
Can you see some obvious flaws or mistakes?
Or
Could you give me an example of a working code?
Or
Could you let me know how best to fix it?