locked
Trying to connect to hosted CRM 4.0 using the CRM2011 SDK. Is this even possible? RRS feed

  • Question

  • Hello there and thanks for reading.

    I am tasked with taking our existing code, which works against CRM 2011 online, and making it backwards compatible with a hosted CRM 4.0 service.

    I've installed CRM 4.0 locally and I can browse to the web site and add contacts, accounts, etc from my development machine.

    I can connect using the 4.0 SDK with the following code:

    var connection = CrmConnection.Parse(@"Authentication Type=AD; Server=http://athyra/Bizmosis;User ID=XXX\XXXXX;Password=XXXXXXX");
    var crm = new Xrm.XrmDataContext(connection);

    var accounts = crm.GetEntities("account");
    accounts.ToList().ForEach(x => DoSomething(x));

    However, I have tried everything I can think of to accomplish the same thing with the CRM 2011 SDK.

    example code:

      // tried every url I could think of here including 2007/AD/CrmDiscoveryService.asmx, etc:

    private string url = "http://athyra/mscrmservices/2007/crmservice.asmx";

                    ClientCredentials deviceCreds = DeviceIdManager.LoadOrRegisterDevice();
                    ClientCredentials credentials = new ClientCredentials();

                    credentials.UserName.UserName = @"XXXX\XXXXX";
                    credentials.UserName.Password = @"XXXXXXX";

    using (serviceProxy = new OrganizationServiceProxy(crmUri, null, credentials, deviceCreds))

    {

    }

    I keep getting the exception:

    "Metadata contains a reference that cannot be resolved: 'http://athyra/mscrmservices/2007/crmservice.asmx?wsdl'."

    with inner exception of (401) unauthorized.

    So my question is, is this even possible? Or do I have to connect using the 4.0 SDK ?

    Thanks for your time,

    Jacob Clark

    Tuesday, May 1, 2012 3:56 PM

Answers

All replies

  • You have to use 4.0 SDK. 

    Daniel Cai | http://danielcai.blogspot.com | @danielwcai | Data Integration made easy with SSIS Integration Toolkit

    • Marked as answer by Ryan Turner Tuesday, May 1, 2012 4:55 PM
    Tuesday, May 1, 2012 4:46 PM
  • Ok, that's a bummer but it is what it is.

    So, the next question is can I use any of the 2011 SDK objects? I assume not, but it would keep me from having to rewite a lot of code.

    Thanks,

    Jacob


    thanks, Jacob Clark

    Tuesday, May 1, 2012 4:48 PM
  • You are right, you cannot use 2011 SDK objects. 

    The two versions have some similar web service messages (say AssignRequest, etc.), but they sometimes take different parameters. Most importantly, the two entity classes (DynamicEntity, Entity) are vastly different, so there is very little chance for re-used code between the two versions. 


    Daniel Cai | http://danielcai.blogspot.com | @danielwcai | Data Integration made easy with SSIS Integration Toolkit

    Tuesday, May 1, 2012 4:54 PM
  • Thanks for the reply. At least I get paid to do this :)

    thanks, Jacob Clark

    Tuesday, May 1, 2012 4:55 PM
  • That's good to know. ;-)

    If you are using CRM LINQ provider, the two versions do share more similarity than the late-bound entity classes. But the similarity is only code base, the class types are still different, since they live in different namespace, essentially they are different objects in C#. 


    Daniel Cai | http://danielcai.blogspot.com | @danielwcai | Data Integration made easy with SSIS Integration Toolkit

    Tuesday, May 1, 2012 5:00 PM