Created
August 7, 2017 19:50
-
-
Save henzard/3883228cc2d1b3eb612814137e6f60ce to your computer and use it in GitHub Desktop.
This file contains hidden or 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
PrivateApplication = Connect(); | |
List<Contact> CompanyContacts = new List<Contact>(); | |
Thread.Sleep(1200); | |
XeroLogging.Info("GetContacts Page #" + Request.ToString()); | |
try | |
{ | |
CompanyContacts = PrivateApplication.Contacts.Page(Request).Find().ToList(); | |
XeroLogging.Info("GetContacts Page Success #" + Request.ToString()); | |
} | |
catch (ValidationException ex) | |
{ | |
XeroLogging.Warning(ex); | |
} | |
catch (NotFoundException ex) | |
{ | |
XeroLogging.Error(ex); | |
} | |
catch (BadRequestException ex) | |
{ | |
XeroLogging.Error(ex); | |
} | |
catch (RateExceededException ex) | |
{ | |
XeroLogging.Error(ex); | |
} | |
catch (Exception ex) | |
{ | |
XeroLogging.Error(ex); | |
} | |
if (CompanyContacts.Count > 0) | |
{ | |
Request++; | |
CompanyContacts.AddRange(GetContacts(Request)); | |
XeroLogging.Info("GetContacts Merged #" + Request.ToString()); | |
return CompanyContacts; | |
} | |
else | |
{ | |
return CompanyContacts; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment