Created
March 29, 2012 20:28
-
-
Save danbarratt/2243414 to your computer and use it in GitHub Desktop.
Download all GL Journals from XeroAPI.dll wrapper library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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