Hello I'm Having problem getting the ExpensesList in Cheque in Quickbooks Here is my code:
bool sessionBegun = false;
bool connectionOpen = false;
QBSessionManager sessionManager = null;
try
{
//Create the session Manager object
sessionManager = new QBSessionManager();
//Create the message set request object to hold our request
IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US", 8, 0);
requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;
//Connect to QuickBooks and begin a session
sessionManager.OpenConnection("", "Sample Code from OSR");
connectionOpen = true;
sessionManager.BeginSession(@"C:\Users\Public\Documents\Intuit\QuickBooks\Company Files\EsdeSolosyon.QBW", ENOpenMode.omDontCare);
sessionBegun = true;
ICheckQuery checkQueryRq = requestMsgSet.AppendCheckQueryRq();
//Send the request and get the response from QuickBooks
IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
IResponse response = responseMsgSet.ResponseList.GetAt(0);
ICheckRetList checkRetList = (ICheckRetList)response.Detail;
if (checkRetList != null)
{
for (int i = 0; i < checkRetList.Count; i++)
{
ICheckRet checkRet = checkRetList.GetAt(i);
IExpenseLineRetList expenseList = checkRetList.GetAt(i).ExpenseLineRetList;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error");
}
In my picture the expenseslist returns null and in my Quickbooks program
But in my QuickBooks every cheque has expenses
BTW in quickbooks you cannot add Cheque if you don't have any ExpensesList