-
Notifications
You must be signed in to change notification settings - Fork 72
Description
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...)