Delete an Invoice using QBO SDK

Delete an Invoice using QBO SDK C#.NET Code

Delete an Invoice using QBO SDK C#.NET Code
                    
var dsvc = new DataService(context);

var iv = new Invoice();

var ivcs = dsvc.FindAll(iv, 1,1).ToList();

ivcs.ForEach(x=>

{



dsvc.Delete(x);


});


//Common exception
//Value of ItemElementName mismatches the type of System.Decimal; you need to set it to Intuit.Ipp.Data.ItemChoiceType.@UnitPrice.


//Add for Serialization:
//Converting Json to Xml and vice versa causes a serialization issue. Both the request/response format should be same. 

serviceContext.IppConfiguration.Message.Request.SerializationFormat = Intuit.Ipp.Core.Configuration.SerializationFormat.Xml; 
serviceContext.IppConfiguration.Message.Response.SerializationFormat = Intuit.Ipp.Core.Configuration.SerializationFormat.Xml; 

or 

serviceContext.IppConfiguration.Message.Request.SerializationFormat = Intuit.Ipp.Core.Configuration.SerializationFormat.Json; 
serviceContext.IppConfiguration.Message.Response.SerializationFormat = Intuit.Ipp.Core.Configuration.SerializationFormat.Json;