Search code examples
dynamics-crmdynamics-crm-online

Applying OrganizationServiceProxy when connecting to CRM Dynamics On-line


I'm connecting successfully to on-premise server using the organization service by this code.

using (OrganizationServiceProxy proxy = new OrganizationServiceProxy(
  Organization, 
  HomeRealm, 
  CredentialsForClient, 
  CredentialsForDevice)) { ... }

Organization is our server plus the suffix OrgName/XRMServices/2011/Organization.svc. CredentialsForClient is my log-in (or my live ID when going for on-line). HomeRealm and CredentialsForDevice are set to null.

This appears to work perfectly for on-premise version but when I go on-line, I get an error. I can create the proxy variable but when I attempt to execute the code below, the exception tells me that I can't have a null value as an end point. This is hardly telling me anything, due to my ignorance.

EntityCollection entityCollection = proxy.RetrieveMultiple(fetchExpression);

Of course I'm using a different Organization when going on-line. I copied the string from the settings of our on-line version of CRM Dynamics (just as I did for the on-premise version). How can I tackle this problem?


Solution

  • Have you seen this sample, it shows how to Authenticate Users with Microsoft Dynamics CRM Web Services without any helper code for all types of connection, on-premise, on-line.