using Microsoft.xrm to query or retrieve RRS feed

  • Question

  • Hi There,

    I'm working with the new CRM SDK 4.0.12, using the Microsoft.xrm folder and the assemblies therein. Following the documentation here (http://crm.davidyack.com/journal/2010/5/6/new-crm-sdk-new-developer-experience.html), after running the crmsvcutil to copy the entities in my CRM instance into my project as classes, using the Data Context to authenticate, and creating the IOrganizationService, I can create entity instances, but I'm missing the ability to query or retrieve them.

    It seems like the way to do this would be as follows:

    var query = from cmpgn in crmOnline.campaigns
                                where cmpgn.name.Equal("campaignname")
                                select cmpgn;

    My issue is occuring on the first line of that code - 'Microsoft.Xrm.Client.Data.Services.CrmDataContext' does not contain a definition for 'campaigns' ...

    There's nothing remotely close to any entity name in the definitions listed when I hit the "." after CrmOnline. I can create, however, so my service is working, and the classes representing the CRM entities are working. What am I missing?



    Web: http://invoc.net Blog: http://invoc.net/CRM_BPOS_Blog
    Tuesday, July 13, 2010 3:55 PM


  • Ahh - found the issue. I was using this method of connecting to CRM:

    var crmOnline = new CrmDataContext(CrmConnection.Parse("Authentication Type=Passport; Server=https://xxxxxx.crm.dynamics.com/xxxxxxx; User ID = xxxxxxx; Password=xxxxxxx; Device ID=xxxxxxx; Device Password=xxxxxxx"));

    I needed to use the "new DataContext" constructor rather than the "new CrmDataContext" constructor. I'm not sure if the CrmDataContext is a generic class that exists in the assemblies, but the DataContext class was added when I ran the crmsvcutil against my organization and it downloaded all of the CRM entities into my folder. So the entities were there, my data context wasn't recognizing them, and it was because I was using the wrong type of data context.

    If anyone could elucidate further, I'd be happy to learn more.




    Web: http://invoc.net Blog: http://invoc.net/CRM_BPOS_Blog
    Tuesday, July 13, 2010 10:26 PM