In this article, we will learn how to get bills 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.
public ActionResult GetAllBills() { List<Bill> BillList = new List<Bill>(); 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<Bill> querySvc = new QueryService<Bill>(serviceContext); BillList = querySvc.ExecuteIdsQuery("SELECT * FROM bill").ToList(); return View(BillList); } catch (IdsException ex) { return View(BillList); } catch (Exception ex) { return View(BillList); } }
@model List<Intuit.Ipp.Data.Bill> @{ ViewBag.Title = "GetAllBills"; } <h2>Quickbooks online Bill List</h2> <div> <table class="table table-bordered"> <tr> <th>QBO Bill ID</th> <th>Bill Number</th> <th>Bill Date</th> <th>Vendor</th> <th>Total Amount</th> </tr> @foreach (var item in Model) { <tr> <td>@item.Id</td> <td>@item.DocNumber</td> <td>@item.TxnDate.ToString("MM/dd/yyyy")</td> <td>@item.VendorRef.name</td> <td>@item.TotalAmt</td> </tr> } </table> </div>
string EXISTING_BILL_QUERYBYID = string.Format("select * from bill where id = '{0}'", "154"); Bill objBillFound = queryService.ExecuteIdsQuery(EXISTING_BILL_QUERYBYID).FirstOrDefault<Bill>();
So that’s how we can get Bills or query Bills from Quickbooks online.
Output:
In this article, we have to show Create and Used PIPE in angular
In this article, we have to show Create and Used PIPE in angular
In this article, we have to show Create and Used PIPE in angular