I'm trying to add a new Sales Invoice using OData Service. But while Saving it end up with the error "NotAcceptable".
Here is the code that I've Used. It error out on "nav.SaveChanges();" line.
NAV nav = new NAV(new Uri("tenant.dynamics.com/.../Company('Company')"));
nav.Credentials = new NetworkCredential("username", "code");
SalesInvoice invoice = new SalesInvoice()
{
Document_Type = "Invoice",
Sell_to_Customer_Name = "20000",
Posting_Date=DateTime.Now
};
nav.AddObject("SalesInvoices", invoice);
SalesInvoiceSalesLines line = new FEAPIClient.SalesInvoiceSalesLines()
{
Description = "1896-S" ,
Quantity = 1
};
nav.AddRelatedObject(invoice, "SalesInvoiceSalesLines", line);
DataServiceResponse response = nav.SaveChanges();
Thanks in advance for helping out!
Regards,
Himal