henzard
4/12/2016 - 7:39 PM

Fetching all invoices Xero

List<Invoice> AllInvoices = new List<Invoice>();
List<Invoice> CurrentInvoices = new List<Invoice>();
int i = 1;
CurrentInvoices = _api.Invoices.Page(i).Find().OrderBy(e => e.DueDate).ToList();
while(CurrentInvoices != null)
{
    AllInvoices.AddRange(CurrentInvoices);
    i++;
    CurrentInvoices = _api.Invoices.Page(i).Find().OrderBy(e => e.DueDate).ToList();
}