user3204191
user3204191

Reputation: 60

Intuit Quickbooks Online API - How to get purchases

I'm using Intuit's .NET SDK for QBO, and am attempting to get a list of purchases from my qbo account. Here's my C# code...

var qboCashPurchaseQuery = new Intuit.Ipp.Data.Qbo.CashPurchaseQuery();
qboCashPurchaseQuery.PageNumber = 1;
qboCashPurchaseQuery.ResultsPerPage = 100;
var results = qboCashPurchaseQuery.ExecuteQuery<Intuit.Ipp.Data.Qbo.CashPurchase(context).ToList();
grdQuickBooksCustomers.DataSource = results;

I get a table with the number of records matching the number of purchases I expect, but the actual data returned is not what I need.

This is the columns and the first row of data I get back: (sorry for the formatting)

SyncToken   Synchronized   IdsType
0                          Intuit.Ipp.Data.Qbo

This bit of code returns the same kind of weird data for some other functions such as InvoiceQuery. What am I doing wrong here to get this data? How might I actually return the detailed purchase data I need?

Upvotes: 1

Views: 900

Answers (2)

Matthew Steeples
Matthew Steeples

Reputation: 8073

var purchase = new Purchase();

var purchases = ds.FindAll(purchase, 0, 500);

That's how we query our datasets. You have to repeat the query if you've got more than 500 items.

Upvotes: 2

user3277522
user3277522

Reputation: 96

string q = "Select * from Purchase Where PaymentType='Cash' STARTPOSITION 1 MAXRESULTS 100";
dynamic Purchaselist = purchaseQueryService.ExecuteIdsQuery(q);
CashPurchase cashpurchase = new CashPurchase();

foreach (CashPurchase oCash in Purchaselist) {
    //do something
}

Upvotes: 2

Related Questions