0
votes

I have written following code while trying to create a proxy of Organization service in my .NET console app:

IOrganizationService _orgService;

CrmServiceClient crmConn = new CrmServiceClient(ConfigurationManager.ConnectionStrings["TestConnectionString"].ConnectionString);

_orgService = (IOrganizationService)crmConn.OrganizationWebProxyClient != null ? (IOrganizationService)crmConn.OrganizationWebProxyClient : (IOrganizationService)crmConn.OrganizationServiceProxy;

While debugging it is showing an error saying "

Unable to Login to Dynamics CRMOrganizationWebProxyClient is null OrganizationServiceProxy is null OrganizationWebProxyClient is null OrganizationServiceProxy is null.

Following is the connections string

<add name="TestConnectionString" connectionString="Url=https://######.api.crm4.dynamics.com/XRMServices/2011/Organization.svc; Username=######@####.com; Password=#######; Authtype=Office365" />

I have tried playing around with the URL in connection string, but nothing has worked till now.

I can use the same code and Dynamics 365 connection string to connect to Dynamics 365 instance, but it is not working for CRM Online 2016.

Note: We are using Microsoft Dynamics CRM Online 2016 licence, and are logging into CRM through Office 365 accounts.

Any help on this will be much appreciated

thanks

1
<connectionStrings> <add name="TestConnectionString" connectionString="Url=https://abc.crm.dynamics.com; [email protected]; Password=xxxxxx"/> </connectionStrings>dynamicallyCRM
No, this doesn't work. Getting the same error - "Unable to Login to Dynamics CRMOrganizationWebProxyClient is nullOrganizationServiceProxy is nullOrganizationServiceProxy is nullOrganizationServiceProxy is nullOrganizationServiceProxy is null"Nirman
I don't see you including your org name in your connection string. It may not hurt to try that real quick. https://######.api.crm4.dynamics.com/ #OrgName# / XRMServices/2011/Organization.svchack3rfx
@hack3rfx - getting the same error :(Nirman

1 Answers

-1
votes

Your problem can be related with using the wrong version of SDK. Please make sure that you are using version 8.1 of Microsoft.CrmSdk.CoreAssemblies.

Also you need to modify your connection string as following:

<add name="TestConnectionString" connectionString="Url=https://######.api.crm4.dynamics.com; Username=######@####.com; Password=#######;" />