Search code examples
dynamics-crmdynamics-365dynamics-crm-365dynamics-crm-webapi

What does this error mean "The 'RetrieveMultiple' method does not support entities of type" in Dynamics CRM /api/data/<version>?


When I try to execute the request to GET ../api/data/<version>/officedocuments and at least 10 entities, I get an error:

{"error":{"code":"0x80040800","message":"The 'RetrieveMultiple' method does not support entities of type 'officedocument'."}}

The same problem I faced when I was trying to get full JSON of specific entity records

{"error":{"code":"0x80040800","message":"The 'Retrieve' method does not support entities of type 'roletemplate'."}}

Can someone suggest me how can I list all entity records for example for officedocumententity and get full JSON for mentioned above roletemplate records?


Solution

  • If its not allowed/supported means we cannot do it that way. So if you need that entity, then use the workaround of using web api with fetchxml.

    https://crmdev.crm.dynamics.com/api/data/v9.1/roletemplates?fetchXml=<fetch> <entity name="roletemplate" > <attribute name="name" /> <attribute name="roletemplateid" /> </entity> </fetch>
    

    Clear query is like below:

    <fetch>
      <entity name="roletemplate" >
        <attribute name="name" />
        <attribute name="roletemplateid" />
      </entity>
    </fetch>
    

    Similarly, Workaround for that query is using ExecuteFetchRequest

    //Try with IOrganizationService
          var orgService = new OrganizationService(connection);
          //Works
          var orgSvcExecuteFetchResponse = (ExecuteFetchResponse)orgService.Execute(executeFetchReq);
          //Doesn't work
          var orgSvcRetrieveMultipleResponse = orgService.RetrieveMultiple(new FetchExpression(fetch));
    
          //Try with CrmServiceClient:
          var crmSvcClient = new CrmServiceClient(connectionString);
          //Works
          var crmSvcExecuteFetchResponse = crmSvcClient.Execute(executeFetchReq);
          //Doesn't work
          var crmSvcRetrieveMultipleResponse = crmSvcClient.RetrieveMultiple(new FetchExpression(fetch));
    

    List of RetrieveMultiple supported entities can be found here.