How To Get Estimates From Quickbooks Online Using C#

In this article, we will learn how to get estimates from Quickbooks online in .NET MVC web application using SDK.

Before using any Quickbooks online API we need access token, if you don’t know how to get access token then you can find it here.

  • First, we have to create a ServiceContext with Auth tokens and realmId.
  • For that, we need access token and realmId
  • For getting estimates, we have to define a QueryService object.
  • QueryService object needs a ServiceContext object as parameter.
  • So we have to create a Quickbooks QueryService using ServiceContext.
  • Here we are getting all estimates from Quickbooks online, code is as below.
public ActionResult GetAllEstimate()
  List<Estimate> EstimateList = new List<Estimate>();
    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<Estimate> querySvc = new QueryService<Estimate>(serviceContext);
    EstimateList = querySvc.ExecuteIdsQuery("SELECT * FROM Estimate").ToList();

    return View(EstimateList);
  catch (IdsException ex)
    return View(EstimateList);
  catch (Exception ex)
    return View(EstimateList);
  • We will get all the estimate list in the EstimateList object.
  • View Code is as below,
@model List<Intuit.Ipp.Data.Estimate>

    ViewBag.Title = "GetAllEstimate";

<h2>Quickbooks online Estimate List</h2>

    <table class="table table-bordered">
            <th>QBO ID</th>
            <th>Estimate Number</th>
            <th>Due Date</th>
            <th>Total Amount</th>

        @foreach (var item in Model)

  • We can also write a query according to our requirements, as like below
string EXISTING_ESTIMATE_QUERYBYID = string.Format("select * from Estimate where id = '{0}'", "148");
Estimate objEstimateFound = queryService.ExecuteIdsQuery(EXISTING_ESTIMATE_QUERYBYID).FirstOrDefault<Estimate>();
  • it will return an estimate by id.
  • We will get an estimate which id=”148” in the objEstimateFound object.

So that’s how we can get estimates or query estimates from Quickbooks online.




  1. oprol evorter

    Generally I don’t read article on blogs, but I would like to say that this write-up very forced me to try and do so! Your writing style has been surprised me. Thanks, very nice article.

  2. baccarat

    Love summer !

  3. 바카라

    Technology is way more impresive then before !


Submit a Comment

Your email address will not be published. Required fields are marked *


Select Categories