Skip to content

Batch create not working (on-prem) #104

Description

@hvdeath

When you try to create multiple item in one Create (batch) it throws the following exception:

 System.ArgumentException : Invalid 'HttpContent' instance provided. It does not have a content type header starting with 'multipart/'.
    Parameter name: content

I downloaded and tried to ran the built in tests and it also failed (BasicCRUDTests.TestMethod1) with the same.

I set up CRMWebAPI with the following code (for test):
CRMWebAPI api = new CRMWebAPI("https://crm/D365DEV/api/data/v9.0/", new NetworkCredential("username", "pass", "domain"));

And run the following:
List<object> batchList = new List<object>(); for (int i = 0; i < 5; i++) { dynamic batchCreateData = new ExpandoObject(); batchCreateData.name = "test " + DateTime.Now.ToString(); batchList.Add(batchCreateData); } Results.CRMBatchResult batchResults = await api.Create("accounts", batchList.ToArray());

I saw the code and this method created its own HttpClient which do not take care of on-prem scenario.

Is there any chance to fix it? (or maybe I can create a PR, but I saw that the code didn't change a while...)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions