You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe there is an error in the formation of URIs which reference Content-IDs from earlier batch operations. I'm not sure if this is a problem with Simple.OData or Microsoft.Data.OData. Here's the code and resulting content of one of my batch requests:
var batch = new ODataBatch(client, true);
var quote = new
{
name = "Quote name",
customerid_contact = new { contactid = crmContact.contactid },
opportunityid = new { opportunityid = opportunityGUID },
};
batch += async c => await c.For<CRM.quote>()
.Set(quote)
.InsertEntryAsync(false);
batch += c => c.For<CRM.quotedetail>()
.Set(new
{
ispriceoverridden = true,
priceperunit = QuoteValue ?? 0,
productid = crmProduct,
quantity = 1,
quoteid = quote,
uomid = new CRM.uom { uomid = crmProduct.defaultuomid.uomid }
})
.InsertEntryAsync(false);
await batch.ExecuteAsync();
Content (added formatting to the json for clarity):
I encountered this bug and look in the code a bit.
The cause of this bug is not in MS.Data.OData but in this package. There's a line that builds an absolute URI from $1.
Would love a patched release, it's currently impossible to reference entities in changeset.
Note
Bonus chatter, if you attempt to use change-id references.
It only works if the referenced POST does not have Prefer: return=representation.
In Simple.OData.Client, this means you must call InsertEntryAsync(resultRequired: false), otherwise your request will fail.
I believe there is an error in the formation of URIs which reference Content-IDs from earlier batch operations. I'm not sure if this is a problem with Simple.OData or Microsoft.Data.OData. Here's the code and resulting content of one of my batch requests:
Content (added formatting to the json for clarity):
According to this answer, and a successful manual test in Postman, the content-id references are absolute and so the bold line above should be:
Interestingly, this is how the URL is formatted in the wiki.
The text was updated successfully, but these errors were encountered: