I'm trying to retrieve a list of Account objects from Salesforce using SOQL. Originally my query was this:
var result = service.query("SELECT Id, Name, RecordTypeId FROM Account");
return result.records.Select(record => record as Account).ToList();
However this only returns a maximum of 2,000 records and I have over that which I need to be returned by this query. After some digging around I found an example in Java which loops over the SOQL query which will allow a maximum of 10,000 records to be returned. I tried to replicate this in C# but it differs slightly, here is what I have now:
var accounts = new List<Account>();
foreach (Account account in service.query("SELECT Id, Name, Composer_ID__c, RecordTypeId FROM Account").records)
accounts.Add(account);
return accounts;
However this still only returns a maximum of 2,000 records. How can I return more than 2,000 records by querying Account?