Skip to content

Instantly share code, notes, and snippets.

@danbarratt
Created March 29, 2012 20:28
Show Gist options
  • Save danbarratt/2243414 to your computer and use it in GitHub Desktop.
Save danbarratt/2243414 to your computer and use it in GitHub Desktop.
Download all GL Journals from XeroAPI.dll wrapper library
// Get GL Journals using the ?offset=xxx parameter
List<Journal> allJournals = new List<Journal>();
List<Journal> batchOfJournals;
int skip = 0;
while ((batchOfJournals = repository.Journals.Skip(skip).ToList()).Count > 0)
{
Console.WriteLine("Fetched {0} journals from API using skip={1}", batchOfJournals.Count, skip);
allJournals.AddRange(batchOfJournals);
skip += batchOfJournals.Count;
}
Console.WriteLine("All Journals starts with {0} and ends with {1}", allJournals.First().JournalNumber, allJournals.Last().JournalNumber);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment