0

hi i am working on a program with c# that fetch all invoices from quickbooks company file, any ideas... i tried this code but i am not developping a web app

public ActionResult GetAllInvoice()
{
  List<Invoice> InvoiceList = new List<Invoice>();
  try
  {
    OAuth2RequestValidator oauthValidator = new OAuth2RequestValidator(Access_token);
    // Create a ServiceContext with Auth tokens and realmId
    ServiceContext serviceContext = new ServiceContext(RealmId, IntuitServicesType.QBO, oauthValidator);
    serviceContext.IppConfiguration.MinorVersion.Qbo = "23";
    serviceContext.IppConfiguration.BaseUrl.Qbo = QboBaseUrl;
    // Create a QuickBooks QueryService using ServiceContext
    QueryService<Invoice> querySvc = new QueryService<Invoice>(serviceContext);
    InvoiceList = querySvc.ExecuteIdsQuery("SELECT * FROM Invoice").ToList();
    return View(InvoiceList);
  }
  catch (IdsException ex)
  {
    return View(InvoiceList);
  }
  catch (Exception ex)
  {
    return View(InvoiceList);
  }
}

0 Answers0