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;
}