Skip to content

Instantly share code, notes, and snippets.

@henzard
Created August 7, 2017 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henzard/3883228cc2d1b3eb612814137e6f60ce to your computer and use it in GitHub Desktop.
Save henzard/3883228cc2d1b3eb612814137e6f60ce to your computer and use it in GitHub Desktop.
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