In this article, we will learn how to get tax agencies 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 GetAllTaxAgencies() { List<TaxAgency> TaxAgencyList = new List<TaxAgency>(); 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<TaxAgency> querySvc = new QueryService<TaxAgency>(serviceContext); TaxAgencyList = querySvc.ExecuteIdsQuery("SELECT * FROM TaxAgency").ToList(); return View(TaxAgencyList); } catch (IdsException ex) { return View(TaxAgencyList); } catch (Exception ex) { return View(TaxAgencyList); } }
@model List<Intuit.Ipp.Data.TaxAgency> @{ ViewBag.Title = "GetAllTaxAgencies"; } <h2>Quickbooks online Tax Agencies</h2> <div> <table class="table table-bordered"> <tr> <th>QBO ID</th> <th>Display Name</th> </tr> @foreach (var TAItem in Model) { <tr> <td>@TAItem.Id</td> <td>@TAItem.DisplayName</td> </tr> } </table> </div>
string EXISTING_TAXAGENCY_QUERYBYID = string.Format("select * from TaxAgency where id = '{0}'", "4"); TaxAgency objTaxAgencyFound = queryService.ExecuteIdsQuery(EXISTING_TAXAGENCY_QUERYBYID).FirstOrDefault<TaxAgency>();
So that’s how we can get “tax agencies” or query “tax agency” 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