### QuickBooks POS SDK Setup and Example Usage Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbpos/transferslipadd This C# code snippet provides a basic setup for interacting with the QuickBooks Point of Sale SDK, including necessary using statements and a placeholder for request creation and response parsing. It's intended as an illustrative example and not for production use without careful consideration. ```C# //The following sample code is generated as an illustration of //Creating requests and parsing responses ONLY //This code is NOT intended to show best practices or ideal code //Use at your most careful discretion using System; using System.Net; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using Interop.qbposfc4; ``` -------------------------------- ### C# Example for SalesRepAdd Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/salesrepadd This C# code snippet demonstrates how to initiate a QuickBooks Desktop API session and prepare to add a sales representative. It includes necessary imports and session management setup. Use this code as a starting point for integrating with the QuickBooks API. ```csharp 'The following sample code is generated as an illustration of 'Creating requests and parsing responses ONLY 'This code is NOT intended to show best practices or ideal code 'Use at your most careful discretion imports System imports System.Net imports System.Drawing imports System.Collections imports System.ComponentModel imports System.Windows.Forms imports System.Data imports System.IO imports Interop.QBFC16 Module com.intuit.idn.samples Public Class Sample Public Sub DoSalesRepAdd() Dim sessionBegun as Boolean sessionBegun = False Dim connectionOpen as Boolean connectionOpen = False Dim sessionManager as QBSessionManager ``` -------------------------------- ### Basic ListDisplayAdd Request and Response Example Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/listdisplayadd This C# example demonstrates the basic setup for sending a ListDisplayAdd request and handling the response using the QuickBooks SDK. It includes session management and request building. ```C# //The following sample code is generated as an illustration of //Creating requests and parsing responses ONLY //This code is NOT intended to show best practices or ideal code //Use at your most careful discretion using System; using System.Net; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using Interop.QBFC16; namespace com.intuit.idn.samples { public class Sample { public void DoListDisplayAdd() { 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",16,0); requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue; BuildListDisplayAddRq(requestMsgSet); //Connect to QuickBooks and begin a session sessionManager.OpenConnection("","Sample Code from OSR"); connectionOpen = true; sessionManager.BeginSession("", ENOpenMode.omDontCare); sessionBegun = true; //Send the request and get the response from QuickBooks ``` -------------------------------- ### QuickBooks SDK Setup and CurrencyAdd Example in C# Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/currencyadd This C# code snippet demonstrates the basic setup for using the QuickBooks SDK, including session management and connection handling. It serves as a foundation for making API calls like CurrencyAdd. Note that this is a sample and not intended for production use without careful review. ```csharp using System; using System.Net; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using Interop.QBFC16; namespace com.intuit.idn.samples { public class Sample { public void DoCurrencyAdd() { bool sessionBegun = false; bool connectionOpen = false; QBSessionManager sessionManager = null; try { ``` -------------------------------- ### C# Example: Initialize and Execute Query Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/accounttaxlineinfoquery This C# code snippet demonstrates the basic setup for interacting with the QuickBooks SDK, including creating a session manager, opening a connection, building a request, executing it, and handling potential exceptions. It also shows how to end the session and close the connection. ```csharp //The following sample code is generated as an illustration of //Creating requests and parsing responses ONLY //This code is NOT intended to show best practices or ideal code //Use at your most careful discretion using System; using System.Net; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using Interop.QBFC16; namespace com.intuit.idn.samples { public class Sample { public void DoAccountTaxLineInfoQuery() { bool sessionBegun = false; bool connectionOpen = false; QBSessionManager sessionManager = null; try { //Create the session Manager object sessionManager = new QBSessionManager(); Dim responseMsgSet as IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet) 'End the session and close the connection to QuickBooks sessionManager.EndSession() sessionBegun = False sessionManager.CloseConnection() connectionOpen = False WalkAccountTaxLineInfoQueryRs(responseMsgSet) Catch e as Exception MessageBox.Show(e.Message, "Error") if (sessionBegun) then sessionManager.EndSession() End If if (connectionOpen) then sessionManager.CloseConnection() End If End Try } Public Sub BuildAccountTaxLineInfoQueryRq(requestMsgSet as IMsgSetRequest) Dim AccountTaxLineInfoQueryRq as IAccountTaxLineInfoQuery AccountTaxLineInfoQueryRq= requestMsgSet.AppendAccountTaxLineInfoQueryRq() End Sub Public Sub WalkAccountTaxLineInfoQueryRs( responseMsgSet as IMsgSetResponse) if (responseMsgSet is nothing) then Exit Sub End If Dim responseList as IResponseList responseList = responseMsgSet.ResponseList if (responseList is nothing) then Exit Sub End If 'if we sent only one request, there is only one response, we'll walk the list for this sample for j=0 to responseList.Count-1 Dim response as IResponse response = responseList.GetAt(j) 'check the status code of the response, 0=ok, >0 is warning if (response.StatusCode >= 0) then 'the request-specific response is in the details, make sure we have some if (not response.Detail is nothing) then 'make sure the response is the type we're expecting Dim responseType as ENResponseType responseType = CType(response.Type.GetValue(),ENResponseType) if (responseType == ENResponseType.rtAccountTaxLineInfoQueryRs) then 'upcast to more specific type here, this is safe because we checked with response.Type check above Dim AccountTaxLineInfoRet as IAccountTaxLineInfoRetList AccountTaxLineInfoRet = CType(response.Detail,IAccountTaxLineInfoRetList) WalkAccountTaxLineInfoRet(AccountTaxLineInfoRet) End If End If End If Next j End Sub Public Sub WalkAccountTaxLineInfoRet(AccountTaxLineInfoRet as IAccountTaxLineInfoRetList) if (AccountTaxLineInfoRet is nothing) then Exit Sub End If 'Go through all the elements of IAccountTaxLineInfoRetList 'Get value of TaxLineID if ( not AccountTaxLineInfoRet.TaxLineID is nothing) then Dim TaxLineID501 as Integer TaxLineID501 = AccountTaxLineInfoRet.TaxLineID.GetValue() End If 'Get value of TaxLineName if ( not AccountTaxLineInfoRet.TaxLineName is nothing) then Dim TaxLineName502 as String TaxLineName502 = AccountTaxLineInfoRet.TaxLineName.GetValue() End If End Sub End Class End Module ``` -------------------------------- ### VB.NET Example: Performing a JobTypeQuery Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/jobtypequery This VB.NET code demonstrates how to initiate a JobTypeQuery using the QBSessionManager. It includes setup for the session and request, but the actual request building and response parsing are omitted. Use this as a starting point for integrating job type queries into your application. ```vb.net Imports System Imports System.Net Imports System.Drawing Imports System.Collections Imports System.ComponentModel Imports System.Windows.Forms Imports System.Data Imports System.IO Imports Interop.QBFC16 Module com.intuit.idn.samples Public Class Sample Public Sub DoJobTypeQuery() Dim sessionBegun as Boolean sessionBegun = False Dim connectionOpen as Boolean connectionOpen = False Dim sessionManager as QBSessionManager sessionManager = nothing Try 'Create the session Manager object sessionManager = new QBSessionManager 'Create the message set request object to hold our request Dim requestMsgSet as IMsgSetRequest ``` -------------------------------- ### Get Employee External GUID Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/entityquery Retrieves the external GUID for an employee. This code should be used when the EmployeeRet object is available and not null. ```vbnet if ( not OR.EmployeeRet.ExternalGUID is nothing) then Dim ExternalGUID9436 as String ExternalGUID9436 = OR.EmployeeRet.ExternalGUID.GetValue() End If ``` -------------------------------- ### C# - SalesReceiptAdd Example Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbpos/salesreceiptadd Demonstrates how to initiate a QuickBooks POS session, build a SalesReceiptAdd request, send it, and process the response. Includes error handling for session and connection management. ```csharp using System; using System.Net; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using Interop.qbposfc4; namespace com.intuit.idn.samples { public class SampleSalesReceiptAdd { public void DoSalesReceiptAdd() { bool sessionBegun = false; bool connectionOpen = false; QBPOSSessionManager sessionManager = null; try { //Create the session Manager object sessionManager = new QBPOSSessionManager(); //Create the message set request object to hold our request IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest(4,0); requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue; BuildSalesReceiptAddRq(requestMsgSet); //Connect to QuickBooks and begin a session sessionManager.OpenConnection("","Sample Code from OSR"); connectionOpen = true; sessionManager.BeginSession(""); sessionBegun = true; //Send the request and get the response from QuickBooks IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet); //End the session and close the connection to QuickBooks sessionManager.EndSession(); sessionBegun = false; sessionManager.CloseConnection(); connectionOpen = false; WalkSalesReceiptAddRs(responseMsgSet); } catch (Exception e) { MessageBox.Show(e.Message, "Error"); if (sessionBegun) { sessionManager.EndSession(); } if (connectionOpen) { sessionManager.CloseConnection(); } } } void BuildSalesReceiptAddRq(IMsgSetRequest requestMsgSet) { ISalesReceiptAdd SalesReceiptAddRq= requestMsgSet.AppendSalesReceiptAddRq(); //Set attributes //Set field value for defMacro SalesReceiptAddRq.defMacro.SetValue("IQBStringType"); //Set field value for Associate SalesReceiptAddRq.Associate.SetValue("ab"); //Set field value for Cashier SalesReceiptAddRq.Cashier.SetValue("ab"); //Set field value for Comments SalesReceiptAddRq.Comments.SetValue("ab"); //Set field value for CustomerListID SalesReceiptAddRq.CustomerListID.SetValue("200000-1011023419"); //Set attributes //Set field value for CustomerListID to use Macro SalesReceiptAddRq.CustomerListID.SetValueUseMacro("200000-1011023419"); //Set field value for Discount SalesReceiptAddRq.Discount.SetValue(10.01); //Set field value for DiscountPercent SalesReceiptAddRq.DiscountPercent.SetValue(12.34F); //Set field value for PriceLevelNumber ``` -------------------------------- ### Get Vendor External GUID Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/vendorquery Retrieves the external GUID associated with a vendor. This unique identifier can be used for external system integration. ```csharp string ExternalGUID24472 = (string)VendorRet.ExternalGUID.GetValue(); ``` -------------------------------- ### Initialize and Begin Session for EntityQuery Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/entityquery This snippet demonstrates the initial setup required to begin a session and open a connection for making entity queries in QuickBooks Desktop. It includes necessary using statements and namespace declarations. ```csharp using System; using System.Net; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using Interop.QBFC16; namespace com.intuit.idn.samples { public class Sample { public void DoEntityQuery() { bool sessionBegun = false; bool connectionOpen = false; ``` -------------------------------- ### ItemServiceAdd Request Example Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/itemserviceadd This example demonstrates how to construct an ItemServiceAdd request, including setting various sales and purchase-related fields, and an external GUID. ```APIDOC ## ItemServiceAdd Request ### Description Constructs a request to add a new item to QuickBooks Desktop, specifying sales and purchase details. ### Method Not Applicable (SDK Method) ### Endpoint Not Applicable (SDK Method) ### Parameters #### Request Body (Conceptual - SDK usage) - **ItemServiceAddRq**: The request object for adding an item. - **ORSalesPurchase**: Contains sales and purchase information. - **ORPrice**: Specifies pricing details. - **Price**: Sets a fixed price value. - **PricePercent**: Sets a price as a percentage. - **AccountRef**: Reference to an account. - **ListID**: The List ID of the account. - **FullName**: The Full Name of the account. - **SalesAndPurchase**: Details for sales and purchase transactions. - **SalesDesc**: Description for sales. - **SalesPrice**: The price for sales. - **IncomeAccountRef**: Reference to the income account. - **ListID**: The List ID of the income account. - **FullName**: The Full Name of the income account. - **PurchaseDesc**: Description for purchases. - **PurchaseCost**: The cost for purchases. - **PurchaseTaxCodeRef**: Reference to the purchase tax code. - **ListID**: The List ID of the tax code. - **FullName**: The Full Name of the tax code. - **ExpenseAccountRef**: Reference to the expense account. - **ListID**: The List ID of the expense account. - **FullName**: The Full Name of the expense account. - **PrefVendorRef**: Reference to the preferred vendor. - **ListID**: The List ID of the vendor. - **FullName**: The Full Name of the vendor. - **ExternalGUID**: A unique identifier for the request. - **IncludeRetElementList**: A list of elements to include in the response. ### Request Example ```csharp // Assuming ItemServiceAddRq is an object of the appropriate type // Set field value for Price ItemServiceAddRq.ORSalesPurchase.SalesOrPurchase.ORPrice.Price.SetValue(15.65); // Set field value for PricePercent ItemServiceAddRq.ORSalesPurchase.SalesOrPurchase.ORPrice.PricePercent.SetValue(20.00); // Set field value for AccountRef ItemServiceAddRq.ORSalesPurchase.SalesOrPurchase.AccountRef.ListID.SetValue("200000-1011023419"); ItemServiceAddRq.ORSalesPurchase.SalesOrPurchase.AccountRef.FullName.SetValue("ab"); // Set field value for SalesAndPurchase ItemServiceAddRq.ORSalesPurchase.SalesAndPurchase.SalesDesc.SetValue("ab"); ItemServiceAddRq.ORSalesPurchase.SalesAndPurchase.SalesPrice.SetValue(15.65); ItemServiceAddRq.ORSalesPurchase.SalesAndPurchase.IncomeAccountRef.ListID.SetValue("200000-1011023419"); ItemServiceAddRq.ORSalesPurchase.SalesAndPurchase.IncomeAccountRef.FullName.SetValue("ab"); ItemServiceAddRq.ORSalesPurchase.SalesAndPurchase.PurchaseDesc.SetValue("ab"); ItemServiceAddRq.ORSalesPurchase.SalesAndPurchase.PurchaseCost.SetValue(15.65); ItemServiceAddRq.ORSalesPurchase.SalesAndPurchase.PurchaseTaxCodeRef.ListID.SetValue("200000-1011023419"); ItemServiceAddRq.ORSalesPurchase.SalesAndPurchase.PurchaseTaxCodeRef.FullName.SetValue("ab"); ItemServiceAddRq.ORSalesPurchase.SalesAndPurchase.ExpenseAccountRef.ListID.SetValue("200000-1011023419"); ItemServiceAddRq.ORSalesPurchase.SalesAndPurchase.ExpenseAccountRef.FullName.SetValue("ab"); ItemServiceAddRq.ORSalesPurchase.SalesAndPurchase.PrefVendorRef.ListID.SetValue("200000-1011023419"); ItemServiceAddRq.ORSalesPurchase.SalesAndPurchase.PrefVendorRef.FullName.SetValue("ab"); // Set field value for ExternalGUID ItemServiceAddRq.ExternalGUID.SetValue(Guid.NewGuid().ToString()); // Set field value for IncludeRetElementList ItemServiceAddRq.IncludeRetElementList.Add("ab"); ``` ### Response #### Success Response (200) - **ItemServiceAddRs**: The response object for the ItemServiceAdd request. - **Status**: Indicates the status of the operation. - **StatusCode**: Numeric status code (0 for success). - **StatusSeverity**: Severity of the status. - **StatusMessage**: A message describing the status. - **Detail**: Contains the specific response details. - **ENResponseType**: The type of response. #### Response Example ```json { "ItemServiceAddRs": { "Status": { "StatusCode": 0, "StatusSeverity": "Info", "StatusMessage": "Done" }, "Detail": { "ENResponseType": "rtItemServiceAddRs" } } } ``` ``` -------------------------------- ### C# - Sample Lead Query Implementation Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/leadquery A sample C# implementation demonstrating how to set up a QuickBooks session, build a Lead Query request, and initiate the connection. This code is for illustration purposes only and not production-ready. ```csharp //The following sample code is generated as an illustration of //Creating requests and parsing responses ONLY //This code is NOT intended to show best practices or ideal code //Use at your most careful discretion using System; using System.Net; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using Interop.QBFC16; namespace com.intuit.idn.samples { public class Sample { public void DoLeadQuery() { 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",16,0); requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue; BuildLeadQueryRq(requestMsgSet); //Connect to QuickBooks and begin a session sessionManager.OpenConnection("","Sample Code from OSR"); connectionOpen = true; sessionManager.BeginSession("", ENOpenMode.omDontCare); sessionBegun = true; //Send the request and get the response from QuickBooks ``` -------------------------------- ### Retrieve Employee External GUID Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/employeequery This snippet shows how to retrieve the External GUID for an employee. It includes a check to ensure the ExternalGUID property is not null before attempting to get its value. ```csharp //Get value of ExternalGUID if (EmployeeRet.ExternalGUID != null) { string ExternalGUID8723 = (string)EmployeeRet.ExternalGUID.GetValue(); } ``` -------------------------------- ### QuickBooks SDK Session and Request Setup Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/workerscompcodeadd This C# code illustrates the initial setup for interacting with the QuickBooks SDK. It includes creating a QBSessionManager, setting up a message set request, and opening a connection to QuickBooks. ```C# //The following sample code is generated as an illustration of //Creating requests and parsing responses ONLY //This code is NOT intended to show best practices or ideal code //Use at your most careful discretion using System; using System.Net; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using Interop.QBFC16; namespace com.intuit.idn.samples { public class Sample { public void DoWorkersCompCodeAdd() { 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",16,0); requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue; BuildWorkersCompCodeAddRq(requestMsgSet); //Connect to QuickBooks and begin a session sessionManager.OpenConnection("","Sample Code from OSR"); connectionOpen = true; ``` -------------------------------- ### Query Purchase Orders by Start Ship Date Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbpos/purchaseorderquery Filter purchase orders based on the start ship date using a numeric criterion. This example uses 'less than' for the date. ```vb PurchaseOrderQueryRq.ORStartShipDateFilters.StartShipDateFilter.MatchNumericCriterion.SetValue(ENMatchNumericCriterion.mncLessThan) PurchaseOrderQueryRq.ORStartShipDateFilters.StartShipDateFilter.StartShipDate.SetValue(DateTime.Parse("12/15/2007")) ``` -------------------------------- ### BuildAssemblyAdd Request (QBFC) Source: https://developer.intuit.com/app/developer/qbdesktop/docs/develop/tutorials/the-assemblyitem-and-buildassembly-requests This QBFC example demonstrates how to open a connection, build a specified assembly item, and display the results. ```APIDOC ## BuildAssemblyAdd Request (QBFC) ### Description This example shows a complete self-contained procedure that opens a connection with QuickBooks, builds the specified assembly item in the currently open company, shows the results, and closes the connection. The sample accepts the default ref number that will be assigned by QuickBooks, but specifies the build date. ### Method QBFC (QuickBooks .NET SDK) ### Code Example ```vb Public Sub QBFC_AddBuildAssembly() Dim SessionManager As QBSessionManager Set SessionManager = New QBSessionManager SessionManager.OpenConnection "", "IDN Add Build Assembly Sample" SessionManager.BeginSession "", omDontCare Dim requestMsgSet As IMsgSetRequest Set requestMsgSet = SessionManager.CreateMsgSetRequest("US", 5, 0) ' Initialize the message set request's attributes requestMsgSet.Attributes.OnError = roeStop ' Add the request to the message set request object Dim BuildAssmblyAdd As IBuildAssemblyAdd Set BuildAssmblyAdd = requestMsgSet.AppendBuildAssemblyAddRq 'Set the properties in the BuildAssembly add object BuildAssmblyAdd.ItemInventoryAssemblyRef.FullName.setValue ("Metal Panel Assembly") BuildAssmblyAdd.TxnDate.setValue ("2005-10-26") BuildAssmblyAdd.Memo.setValue ("Build from component list 1") BuildAssmblyAdd.QuantityToBuild.setValue (2) 'Perform the request and obtain a response from QuickBooks Dim responseMsgSet As IMsgSetResponse Set responseMsgSet = SessionManager.DoRequests(requestMsgSet) MsgBox responseMsgSet.ToXMLString 'Close the session and connection with QuickBooks. SessionManager.EndSession SessionManager.CloseConnection End Sub ``` ``` -------------------------------- ### TimeReportQuery Request Setup Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/timereportquery Example of setting up a TimeReportQuery request, specifying various reporting parameters. ```APIDOC ## TimeReportQuery Request Setup ### Description This section demonstrates how to configure a TimeReportQuery request by setting various fields such as SummarizeColumnsBy, IncludeColumnList, IncludeSubcolumns, ReportCalendar, ReturnRows, and ReturnColumns. ### Method Not Applicable (SDK Method) ### Endpoint Not Applicable (SDK Method) ### Parameters #### SDK Specific Parameters - **TimeReportQueryRq.SummarizeColumnsBy** (ENSummarizeColumnsBy) - Sets the column summarization type. Example: `ENSummarizeColumnsBy.scbAccount`. - **TimeReportQueryRq.IncludeColumnList** (ENIncludeColumnList) - Adds columns to be included in the report. Can be added multiple times. Example: `ENIncludeColumnList.iclAccount`. - **TimeReportQueryRq.IncludeSubcolumns** (Boolean) - Specifies whether to include subcolumns. Example: `True`. - **TimeReportQueryRq.ReportCalendar** (ENReportCalendar) - Sets the calendar basis for the report. Example: `ENReportCalendar.rcCalendarYear`. - **TimeReportQueryRq.ReturnRows** (ENReturnRows) - Defines which rows to return. Example: `ENReturnRows.rrActiveOnly`. - **TimeReportQueryRq.ReturnColumns** (ENReturnColumns) - Defines which columns to return. Example: `ENReturnColumns.rcActiveOnly`. ### Request Example ```vb.net 'Set field value for SummarizeColumnsBy TimeReportQueryRq.SummarizeColumnsBy.SetValue(ENSummarizeColumnsBy.scbAccount) 'Set field value for IncludeColumnList 'May create more than one of these if needed TimeReportQueryRq.IncludeColumnList.Add(ENIncludeColumnList.iclAccount) 'Set field value for IncludeSubcolumns TimeReportQueryRq.IncludeSubcolumns.SetValue(True) 'Set field value for ReportCalendar TimeReportQueryRq.ReportCalendar.SetValue(ENReportCalendar.rcCalendarYear) 'Set field value for ReturnRows TimeReportQueryRq.ReturnRows.SetValue(ENReturnRows.rrActiveOnly) 'Set field value for ReturnColumns TimeReportQueryRq.ReturnColumns.SetValue(ENReturnColumns.rcActiveOnly) ``` ### Response #### Success Response (200) Details are processed by `WalkTimeReportQueryRs` and `WalkReportRet`. #### Response Example (See `WalkTimeReportQueryRs` and `WalkReportRet` for response structure) ``` -------------------------------- ### PurchaseOrderAdd Example Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/purchaseorderadd This example demonstrates how to initiate a Purchase Order addition request using the QBFC library. It covers session management, request creation, and error handling. ```APIDOC ## PurchaseOrderAdd ### Description Adds a new Purchase Order to QuickBooks Desktop. ### Method Not Applicable (This is an SDK example) ### Endpoint Not Applicable (This is an SDK example) ### Parameters This section is not applicable as this is an SDK code example. ### Request Example ```csharp //The following sample code is generated as an illustration of //Creating requests and parsing responses ONLY //This code is NOT intended to show best practices or ideal code //Use at your most careful discretion using System; using System.Net; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using Interop.QBFC16; namespace com.intuit.idn.samples { public class Sample { public void DoPurchaseOrderAdd() { 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",16,0); requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue; ``` ### Response This section is not applicable as this is an SDK code example. ``` -------------------------------- ### SalesReceiptAdd Example Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/salesreceiptadd Example of how to construct a SalesReceiptAdd request, including setting exchange rates, external GUIDs, and line item details such as item references, descriptions, quantities, rates, and class references. ```APIDOC ## SalesReceiptAdd ### Description Adds a sales receipt to QuickBooks Desktop. ### Method Not applicable (SDK/API call) ### Endpoint Not applicable (SDK/API call) ### Parameters #### Request Body - **ExchangeRate** (IQBFloatType) - Optional - The exchange rate for the transaction. - **ExternalGUID** (string) - Optional - A unique identifier for the transaction. - **ORSalesReceiptLineAddList** (array) - Required - A list of sales receipt line items. - **SalesReceiptLineAdd** (object) - **defMacro** (IQBStringType) - Optional - Default macro for the line item. - **ItemRef** (object) - **ListID** (string) - Required - The ListID of the item. - **FullName** (string) - Required - The FullName of the item. - **Desc** (string) - Optional - Description of the line item. - **Quantity** (integer) - Optional - The quantity of the item. - **UnitOfMeasure** (string) - Optional - The unit of measure for the item. - **ORRatePriceLevel** (object) - **Rate** (float) - Optional - The rate for the item. - **RatePercent** (float) - Optional - The percentage rate for the item. - **PriceLevelRef** (object) - **ListID** (string) - Required - The ListID of the price level. - **FullName** (string) - Required - The FullName of the price level. - **ClassRef** (object) - **ListID** (string) - Required - The ListID of the class. - **FullName** (string) - Required - The FullName of the class. - **Amount** (float) - Optional - The amount for the line item. - **OptionForPriceRuleConflict** (ENOptionForPriceRuleConflict) - Optional - Specifies how to handle price rule conflicts. - **InventorySiteRef** (object) - **ListID** (string) - Required - The ListID of the inventory site. - **FullName** (string) - Required - The FullName of the inventory site. - **InventorySiteLocationRef** (object) - **ListID** (string) - Required - The ListID of the inventory site location. - **FullName** (string) - Required - The FullName of the inventory site location. - **SerialNumber** (string) - Optional - Serial number for the item. ### Request Example ```qb SalesReceiptAddRq.ExchangeRate.SetValue("IQBFloatType"); SalesReceiptAddRq.ExternalGUID.SetValue(Guid.NewGuid().ToString()); IORSalesReceiptLineAdd ORSalesReceiptLineAddListElement20069 = SalesReceiptAddRq.ORSalesReceiptLineAddList.Append(); ORSalesReceiptLineAddListElement20069.SalesReceiptLineAdd.defMacro.SetValue("IQBStringType"); ORSalesReceiptLineAddListElement20069.SalesReceiptLineAdd.ItemRef.ListID.SetValue("200000-1011023419"); ORSalesReceiptLineAddListElement20069.SalesReceiptLineAdd.ItemRef.FullName.SetValue("ab"); ORSalesReceiptLineAddListElement20069.SalesReceiptLineAdd.Desc.SetValue("ab"); ORSalesReceiptLineAddListElement20069.SalesReceiptLineAdd.Quantity.SetValue(2); ORSalesReceiptLineAddListElement20069.SalesReceiptLineAdd.UnitOfMeasure.SetValue("ab"); ORSalesReceiptLineAddListElement20069.SalesReceiptLineAdd.ORRatePriceLevel.Rate.SetValue(15.65); ORSalesReceiptLineAddListElement20069.SalesReceiptLineAdd.ClassRef.ListID.SetValue("200000-1011023419"); ORSalesReceiptLineAddListElement20069.SalesReceiptLineAdd.ClassRef.FullName.SetValue("ab"); ORSalesReceiptLineAddListElement20069.SalesReceiptLineAdd.Amount.SetValue(10.01); ORSalesReceiptLineAddListElement20069.SalesReceiptLineAdd.OptionForPriceRuleConflict.SetValue(ENOptionForPriceRuleConflict.ofprcZero); ORSalesReceiptLineAddListElement20069.SalesReceiptLineAdd.InventorySiteRef.ListID.SetValue("200000-1011023419"); ORSalesReceiptLineAddListElement20069.SalesReceiptLineAdd.InventorySiteRef.FullName.SetValue("ab"); ORSalesReceiptLineAddListElement20069.SalesReceiptLineAdd.InventorySiteLocationRef.ListID.SetValue("200000-1011023419"); ORSalesReceiptLineAddListElement20069.SalesReceiptLineAdd.InventorySiteLocationRef.FullName.SetValue("ab"); ``` ### Response #### Success Response (200) - **SalesReceiptAddRs** (object) - The response object containing details of the added sales receipt. - **RsHeader** (object) - Header information for the response. - **SalesReceiptAddRs** (object) - Details of the added sales receipt. - **SalesReceiptRet** (object) - Information about the returned sales receipt. - **TxnID** (string) - The transaction ID of the sales receipt. - **TimeCreated** (string) - The date and time the sales receipt was created. - **TimeModified** (string) - The date and time the sales receipt was last modified. - **EditSequence** (string) - The edit sequence number for the sales receipt. - **TxnNumber** (string) - The transaction number of the sales receipt. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### VB.NET Example: Initializing and Opening Connection for CheckAdd Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/checkadd This VB.NET code snippet demonstrates the initial steps for setting up a QuickBooks Desktop API connection, including session management and opening the connection. It serves as a foundational example for subsequent operations like CheckAdd. ```vb.net Imports System Imports System.Net Imports System.Drawing Imports System.Collections Imports System.ComponentModel Imports System.Windows.Forms Imports System.Data Imports System.IO Imports Interop.QBFC16 Module com.intuit.idn.samples Public Class Sample Public Sub DoCheckAdd() Dim sessionBegun as Boolean sessionBegun = False Dim connectionOpen as Boolean connectionOpen = False ``` -------------------------------- ### VB.NET TemplateQuery Example Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/templatequery Illustrative VB.NET code for initiating a TemplateQuery. This example demonstrates the basic setup for making API requests and handling responses, intended for educational purposes. Use with caution. ```vb.net 'The following sample code is generated as an illustration of 'Creating requests and parsing responses ONLY 'This code is NOT intended to show best practices or ideal code 'Use at your most careful discretion imports System imports System.Net imports System.Drawing imports System.Collections imports System.ComponentModel imports System.Windows.Forms imports System.Data imports System.IO imports Interop.QBFC16 Module com.intuit.idn.samples Public Class Sample Public Sub DoTemplateQuery() Dim sessionBegun as Boolean sessionBegun = False Dim connectionOpen as Boolean connectionOpen = False ``` -------------------------------- ### SalesTaxPaymentCheckAddRq Example Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/salestaxpaymentcheckadd This example demonstrates how to construct a SalesTaxPaymentCheckAdd request, setting various address fields, an external GUID, and a sales tax payment line item. It also shows how to add an element to the IncludeRetElementList. ```APIDOC ## SalesTaxPaymentCheckAddRq ### Description Constructs a request to add a sales tax payment check. ### Method Not applicable (SDK method) ### Endpoint Not applicable (SDK method) ### Parameters #### Request Body (Implicit via SDK methods) - `SalesTaxPaymentCheckAddRq.Address.Addr4` (string) - Sets the fourth address line. - `SalesTaxPaymentCheckAddRq.Address.Addr5` (string) - Sets the fifth address line. - `SalesTaxPaymentCheckAddRq.Address.City` (string) - Sets the city. - `SalesTaxPaymentCheckAddRq.Address.State` (string) - Sets the state. - `SalesTaxPaymentCheckAddRq.Address.PostalCode` (string) - Sets the postal code. - `SalesTaxPaymentCheckAddRq.Address.Country` (string) - Sets the country. - `SalesTaxPaymentCheckAddRq.Address.Note` (string) - Sets a note for the address. - `SalesTaxPaymentCheckAddRq.ExternalGUID` (string) - Sets a unique external identifier for the request. - `SalesTaxPaymentCheckAddRq.SalesTaxPaymentCheckLineAddList.Append()` - Appends a new sales tax payment line item. - `ItemSalesTaxRef.ListID` (string) - The List ID of the item sales tax. - `ItemSalesTaxRef.FullName` (string) - The full name of the item sales tax. - `Amount` (double) - The amount of the sales tax payment. - `SalesTaxPaymentCheckAddRq.IncludeRetElementList.Add(string)` - Adds an element to the list of returned elements. ### Request Example ```csharp // Assuming SalesTaxPaymentCheckAddRq is an initialized object SalesTaxPaymentCheckAddRq.Address.Addr4.SetValue("ab"); SalesTaxPaymentCheckAddRq.Address.Addr5.SetValue("ab"); SalesTaxPaymentCheckAddRq.Address.City.SetValue("ab"); SalesTaxPaymentCheckAddRq.Address.State.SetValue("ab"); SalesTaxPaymentCheckAddRq.Address.PostalCode.SetValue("ab"); SalesTaxPaymentCheckAddRq.Address.Country.SetValue("ab"); SalesTaxPaymentCheckAddRq.Address.Note.SetValue("ab"); SalesTaxPaymentCheckAddRq.ExternalGUID.SetValue(Guid.NewGuid().ToString()); ISalesTaxPaymentCheckLineAdd SalesTaxPaymentCheckLineAdd21632 = SalesTaxPaymentCheckAddRq.SalesTaxPaymentCheckLineAddList.Append(); SalesTaxPaymentCheckLineAdd21632.ItemSalesTaxRef.ListID.SetValue("200000-1011023419"); SalesTaxPaymentCheckLineAdd21632.ItemSalesTaxRef.FullName.SetValue("ab"); SalesTaxPaymentCheckLineAdd21632.Amount.SetValue(10.01); SalesTaxPaymentCheckAddRq.IncludeRetElementList.Add("ab"); ``` ### Response #### Success Response (Implicit via SDK) Details are processed by `WalkSalesTaxPaymentCheckAddRs` and `WalkSalesTaxPaymentCheckRet`. #### Response Example (See `WalkSalesTaxPaymentCheckAddRs` and `WalkSalesTaxPaymentCheckRet` for response handling) ``` -------------------------------- ### UIExtensionSubscriptionAdd Example Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/uiextensionsubscriptionadd This example demonstrates how to build a request to add a UI extension subscription using the QBXML SDK. ```APIDOC ## UIExtensionSubscriptionAdd (3.0) ### Description Adds a UI extension subscription to QuickBooks Desktop. This allows for the registration of custom menu items that can be displayed based on specific conditions. ### Method POST (Implied by SDK usage) ### Endpoint Not applicable (SDK method) ### Parameters This method is invoked via the QBXML SDK. The structure of the request is defined within the `BuildUIExtensionSubscriptionAddRq` function, which populates an `ISubscriptionMsgSetRequest` object. ### Request Example ```vb ' This is a conceptual representation of the request building process within the SDK. ' The actual XML request is generated by the SDK based on the method calls. ' Assume requestMsgSet is an ISubscriptionMsgSetRequest object BuildUIExtensionSubscriptionAddRq(requestMsgSet) ' The BuildUIExtensionSubscriptionAddRq function would contain logic similar to: ' Dim uiExtensionSubscriptionAddRq As IU IExtensionSubscriptionAdd ' uiExtensionSubscriptionAddRq = requestMsgSet.AppendUIExtensionSubscriptionAddRq ' ' Dim menuItem As IMenuItem ' menuItem = uiExtensionSubscriptionAddRq.AddMenuItem ' menuItem.Name = "MyCustomMenuItem" ' menuItem.Description = "A custom menu item" ' menuItem.URL = "http://example.com/myextension" ' ' Dim displayCondition As IDisplayCondition ' displayCondition = menuItem.AddDisplayCondition ' Dim enabledIf As IEnabledIf ' enabledIf = displayCondition.AddEnabledIf ' enabledIf.Value = "InventoryEnabled" ``` ### Response #### Success Response (200 OK) Upon successful execution, QuickBooks Desktop will acknowledge the subscription. The response is typically an `ISubscriptionMsgSetResponse` object containing a `UIExtensionSubscriptionAddRs` element. #### Response Example ```xml ``` ``` -------------------------------- ### VehicleMileageAdd Example Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/vehiclemileageadd This C# code example demonstrates how to initiate a session with QuickBooks Desktop, build a VehicleMileageAdd request, send it, and process the response. ```APIDOC ## VehicleMileageAdd ### Description Adds a vehicle mileage record to QuickBooks Desktop. ### Method This is a programmatic interface, not an HTTP method. ### Endpoint N/A (Programmatic Interface) ### Parameters This method is part of a larger SDK interaction. Specific parameters for VehicleMileageAdd are defined within the `BuildVehicleMileageAddRq` method in the SDK. ### Request Example ```csharp // Within the DoVehicleMileageAdd method: BuildVehicleMileageAddRq(requestMsgSet); ``` ### Response The response is processed by the `WalkVehicleMileageAddRs` method, which handles the success or error status and any returned data. #### Success Response (200) Details of the success response are handled within the `WalkVehicleMileageAddRs` method. #### Response Example ```csharp // The WalkVehicleMileageAddRs method would parse the response. ``` ``` -------------------------------- ### SalesReceiptQuery Example Source: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/salesreceiptquery This example demonstrates how to initiate a SalesReceiptQuery request using the QuickBooks Desktop SDK. ```APIDOC ## SalesReceiptQuery ### Description This section provides an example of how to query Sales Receipts using the QuickBooks Desktop SDK. It covers the basic setup for session management and request creation. ### Method Not Applicable (SDK Method) ### Endpoint Not Applicable (SDK Method) ### Parameters This operation is performed via the QuickBooks SDK and does not use standard HTTP parameters. ### Request Example ```vb.net 'The following sample code is generated as an illustration of 'Creating requests and parsing responses ONLY 'This code is NOT intended to show best practices or ideal code 'Use at your most careful discretion imports System imports System.Net imports System.Drawing imports System.Collections imports System.ComponentModel imports System.Windows.Forms imports System.Data imports System.IO imports Interop.QBFC16 Module com.intuit.idn.samples Public Class Sample Public Sub DoSalesReceiptQuery() Dim sessionBegun as Boolean sessionBegun = False Dim connectionOpen as Boolean connectionOpen = False Dim sessionManager as QBSessionManager sessionManager = nothing Try 'Create the session Manager object sessionManager = new QBSessionManager 'Create the message set request object to hold our request Dim requestMsgSet as IMsgSetRequest ``` ### Response #### Success Response Responses are handled by the QuickBooks SDK and depend on the specific query parameters and data available. #### Response Example Not directly applicable as the response is processed by the SDK. ```