CompanyQuery

Returns information about the QBPOS company currently being used by the application. For example, the company name and address, whether the company data is the sample company provided by QBPOS for testing and learning, and certain company preference settings, especially preference settings and/or values needed by other QBPOS SDK requests.


Request

Response

XMLOPS

VB.NET

C#

Tag Type Max length Implementation Required

ICompanyQuery

Returns information about the QBPOS company currently being used by the application. For example, the company name and address, whether the company data is the sample company provided by QBPOS for testing and learning, and certain company preference settings, especially preference settings and/or values needed by other QBPOS SDK requests.
       

OwnerIDList

The list of Owner IDs in the requests. An ownerID refers to the owner of a data extension:If OwnerID is 0, this is a public data extension. For example, if you intend to use this with a custom field that is supported in the UI, you must use an owner ID of 0.If OwnerID is a GUID, for example {6B063959-81B0-4622-85D6-F548C8CCB517}, this field is a private data extension defined by an integrated application. Note that OwnerID values are not case-sensitive, meaning that if you enter an OwnerID value with lower-case letters, the value will be saved and returned with upper-case letters. When you share a private data extension with another application, the other application must know both the OwnerID and the DataExtName, as these together form a data extension’s unique name.
IGUIDList      
Tag Type Max length Implementation Required

IResponse

Returns information about the QBPOS company currently being used by the application. For example, the company name and address, whether the company data is the sample company provided by QBPOS for testing and learning, and certain company preference settings, especially preference settings and/or values needed by other QBPOS SDK requests.
       

StatusCode

A number that corresponds to a statusSeverity and statusMessage. Five status codes relate directly to signon messages: 2000, 2010, 2020, 2030, and 2040. For details about these and other statusCode values that can be returned, see the statusCode table on the Error Codes page.
IQBIntType     Y

StatusSeverity

One of the following values: INFO The request was completed, and the results are consistent with what your application expected. WARNING The request was completed, but the results might not be consistent with what you expected. ERROR The request was not completed. No data will appear in the server’s response after the statusMessage.
IQBStringType     Y

StatusMessage

A user-readable explanation of the success or error condition that is indicated by the statusCode. For details about the statusMessage values that can be returned, see the “Explanation” column of the statusCode table on the Error Codes page.
IQBStringType     Y

Detail

ICompanyRet      

IsSampleCompany

Indicates whether this company file is a QuickBooks “sample file.”
IQBBoolType     Y

CompanyName

The name of the business.
IQBStringType     Y

Address

Address of the company that the current QBPOS company represents.
IAddress     Y

Street

Street Address of the vendor, customer, or other addressee.
IQBStringType     Y

CityStateZIP

City, State, and postal code of the company that the current QBPOS company represents.
IQBStringType     Y

Misc1

Misc1, Misc2, and Misc3 correspond to the Miscellaneous 1, Miscellaneous 2, and Miscellaneous 3 fields, respectively, in the Store Headings information block in the General->Store Info area of company preferences for single store configurations, or in the Multi-Store->Store Headings area for multi-store configurations.
IQBStringType     Y

Misc2

Misc1, Misc2, and Misc3 correspond to the Miscellaneous 1, Miscellaneous 2, and Miscellaneous 3 fields, respectively, in the Store Headings information block in the General->Store Info area of company preferences for single store configurations, or in the Multi-Store->Store Headings area for multi-store configurations.
IQBStringType     Y

Misc3

Misc1, Misc2, and Misc3 correspond to the Miscellaneous 1, Miscellaneous 2, and Miscellaneous 3 fields, respectively, in the Store Headings information block in the General->Store Info area of company preferences for single store configurations, or in the Multi-Store->Store Headings area for multi-store configurations.
IQBStringType     Y

QuickBooksCompanyFile

The company file name specified in company preferences is returned in this CompanyQuery response field. QBPOS can share data from certain transactions with QuickBooks. In order for this to happen, however, the company preferences checkbox in the Financial area must be checked, and the QuickBooks company filed must be specified in the textbox under that checkbox.
IQBStringType      

StoreNumber

This is used only for multi-store versions of QBPOS. The value is between 1 and 10, since a maximum of 10 stores are currently supported.
IQBIntType     Y

StoreCode

Store codes are located in the Multi-Store->StoreCodes area of company preferences. Store codes are 3-character codes specified by the QBPOS company administrator in company preferences and are used to represent the store in QBPOS. If the QBPOS company is used with QuickBooks, the store code may be mapped to a QuickBooks class to track certain store activities.
IQBIntType     Y

StoreList

The list of stores set in the company preferences. Available only in multi-store versions of QBPOS.
IStoreList      

(List of IStore Objects)

       

StoreNumber

This is used only for multi-store versions of QBPOS. The value is between 1 and 10, since a maximum of 10 stores are currently supported.
IQBIntType     Y

StoreCode

Store codes are located in the Multi-Store->StoreCodes area of company preferences. Store codes are 3-character codes specified by the QBPOS company administrator in company preferences and are used to represent the store in QBPOS. If the QBPOS company is used with QuickBooks, the store code may be mapped to a QuickBooks class to track certain store activities.
IQBIntType     Y

StoreName

The name of the store in the current Store aggregate. Store names are located in the Multi-Store->StoreHeadings area of company preferences.
IQBStringType     Y

Address

Address of the company that the current QBPOS company represents.
IAddress     Y

Street

Street Address of the vendor, customer, or other addressee.
IQBStringType     Y

CityStateZIP

City, State, and postal code of the company that the current QBPOS company represents.
IQBStringType     Y

Misc1

Misc1, Misc2, and Misc3 correspond to the Miscellaneous 1, Miscellaneous 2, and Miscellaneous 3 fields, respectively, in the Store Headings information block in the General->Store Info area of company preferences for single store configurations, or in the Multi-Store->Store Headings area for multi-store configurations.
IQBStringType     Y

Misc2

Misc1, Misc2, and Misc3 correspond to the Miscellaneous 1, Miscellaneous 2, and Miscellaneous 3 fields, respectively, in the Store Headings information block in the General->Store Info area of company preferences for single store configurations, or in the Multi-Store->Store Headings area for multi-store configurations.
IQBStringType     Y

Misc3

Misc1, Misc2, and Misc3 correspond to the Miscellaneous 1, Miscellaneous 2, and Miscellaneous 3 fields, respectively, in the Store Headings information block in the General->Store Info area of company preferences for single store configurations, or in the Multi-Store->Store Headings area for multi-store configurations.
IQBStringType     Y

PriceLevel1

The current PriceLevel1 setting in QBPOS in the current company preferences.The QBPOS adminstrator can specify up to 5 price levels that establish the default pricing structure for inventory items. PriceLevel1 is the baseline or everyday retail price of the item, so there is normally no markdown for this pricelevel. PriceLevels 2 through 5 specify discount pricing for the item, expressed as markdown percentages from the first price. Notice that when an inventory item is created, or modified, it can be set up to use a different pricing structure via the inventory item’s Price1 through Price5 fields. Items set up in this way use their own pricing structure and not the default one specified in the company preferences.
IPriceLevel1     Y

Name

The name of the price level. Normally, these names should reflect an order of increasing discount, but the QBPOS can specify any names.
IQBStringType     Y

Markdown

The percent by which the first price level is reduced in this price level. The first price level has no markdown.
IQBPercentType     Y

PriceLevel2

The current PriceLevel1 setting in QBPOS in the current company preferences.The QBPOS adminstrator can specify up to 5 price levels that establish the default pricing structure for inventory items. PriceLevel1 is the baseline or everyday retail price of the item, so there is normally no markdown for this pricelevel. PriceLevels 2 through 5 specify discount pricing for the item, expressed as markdown percentages from the first price. Notice that when an inventory item is created, or modified, it can be set up to use a different pricing structure via the inventory item’s Price1 through Price5 fields. Items set up in this way use their own pricing structure and not the default one specified in the company preferences.
IPriceLevel2     Y

Name

The name of the price level. Normally, these names should reflect an order of increasing discount, but the QBPOS can specify any names.
IQBStringType     Y

Markdown

The percent by which the first price level is reduced in this price level. The first price level has no markdown.
IQBPercentType     Y

PriceLevel3

The current PriceLevel1 setting in QBPOS in the current company preferences.The QBPOS adminstrator can specify up to 5 price levels that establish the default pricing structure for inventory items. PriceLevel1 is the baseline or everyday retail price of the item, so there is normally no markdown for this pricelevel. PriceLevels 2 through 5 specify discount pricing for the item, expressed as markdown percentages from the first price. Notice that when an inventory item is created, or modified, it can be set up to use a different pricing structure via the inventory item’s Price1 through Price5 fields. Items set up in this way use their own pricing structure and not the default one specified in the company preferences.
IPriceLevel3     Y

Name

The name of the price level. Normally, these names should reflect an order of increasing discount, but the QBPOS can specify any names.
IQBStringType     Y

Markdown

The percent by which the first price level is reduced in this price level. The first price level has no markdown.
IQBPercentType     Y

PriceLevel4

The current PriceLevel1 setting in QBPOS in the current company preferences.The QBPOS adminstrator can specify up to 5 price levels that establish the default pricing structure for inventory items. PriceLevel1 is the baseline or everyday retail price of the item, so there is normally no markdown for this pricelevel. PriceLevels 2 through 5 specify discount pricing for the item, expressed as markdown percentages from the first price. Notice that when an inventory item is created, or modified, it can be set up to use a different pricing structure via the inventory item’s Price1 through Price5 fields. Items set up in this way use their own pricing structure and not the default one specified in the company preferences.
IPriceLevel4     Y

Name

The name of the price level. Normally, these names should reflect an order of increasing discount, but the QBPOS can specify any names.
IQBStringType     Y

Markdown

The percent by which the first price level is reduced in this price level. The first price level has no markdown.
IQBPercentType     Y

PriceLevel5

The current PriceLevel1 setting in QBPOS in the current company preferences.The QBPOS adminstrator can specify up to 5 price levels that establish the default pricing structure for inventory items. PriceLevel1 is the baseline or everyday retail price of the item, so there is normally no markdown for this pricelevel. PriceLevels 2 through 5 specify discount pricing for the item, expressed as markdown percentages from the first price. Notice that when an inventory item is created, or modified, it can be set up to use a different pricing structure via the inventory item’s Price1 through Price5 fields. Items set up in this way use their own pricing structure and not the default one specified in the company preferences.
IPriceLevel5   1.1 Y

Name

The name of the price level. Normally, these names should reflect an order of increasing discount, but the QBPOS can specify any names.
IQBStringType     Y

Markdown

The percent by which the first price level is reduced in this price level. The first price level has no markdown.
IQBPercentType     Y

PurchaseOrderStatusInfo

Provides information about the purchase order statuses currently defined in the company preferences.
IPurchaseOrderStatusInfo     Y

OrderStatusDataList

The list of the order statuses currently specified in the company preferences.
IOrderStatusDataList     Y

(List of IOrderStatusData Objects)

       

StatusType

The status type can be Open, Closed, or Custom. There can be many Custom statuses, with each having its own description.
IQBENStatusTypeType     Y

StatusDescription

The status description added by the QBPOS administrator.
IQBStringType     Y

LayawayStatusInfo

The layaway status of the layaway order. Default statuses are open and closed, but additional statuses can be specified in company preferences.
ILayawayStatusInfo     Y

OrderStatusDataList

The list of the order statuses currently specified in the company preferences.
IOrderStatusDataList     Y

(List of IOrderStatusData Objects)

       

StatusType

The status type can be Open, Closed, or Custom. There can be many Custom statuses, with each having its own description.
IQBENStatusTypeType     Y

StatusDescription

The status description added by the QBPOS administrator.
IQBStringType     Y

SalesOrderStatusInfo

Contains the sales order statuses currently defined for sales order. The statuses OPEN and CLOSED are predefined, but a QBPOS user can also create custom statuses in the company preferences.
ISalesOrderStatusInfo     Y

OrderStatusDataList

The list of the order statuses currently specified in the company preferences.
IOrderStatusDataList     Y

(List of IOrderStatusData Objects)

       

StatusType

The status type can be Open, Closed, or Custom. There can be many Custom statuses, with each having its own description.
IQBENStatusTypeType     Y

StatusDescription

The status description added by the QBPOS administrator.
IQBStringType     Y

WorkOrderStatusInfo

Contains information about the statuses currently defined in the company preferences for work orders.
IWorkOrderStatusInfo     Y

OrderStatusDataList

The list of the order statuses currently specified in the company preferences.
IOrderStatusDataList     Y

(List of IOrderStatusData Objects)

       

StatusType

The status type can be Open, Closed, or Custom. There can be many Custom statuses, with each having its own description.
IQBENStatusTypeType     Y

StatusDescription

The status description added by the QBPOS administrator.
IQBStringType     Y

IsUsingUnitsOfMeasure

Indicates whether the units of measure (UOM) feature is turned on in this QBPOS company.
IQBBoolType   2.0 Y

IsUsingIntegratedShipping

Indicator that QuickBooks Shipping Manager has been enabled.
IQBBoolType   2.5 Y

ShippingProviderList

The list of shipping companies currently set up in the company preferences.
IBSTRList      

TaxRecordList

The list of tax records set in the company preferences. Each QBPOS company has one or more tax listings, or records, each of which contains a tax category value, and a tax code value that identifies that tax in QBPOS, and a tax rate (percent tax). Optionally, if the company is configured to use QuickBooks, the QBPOS tax record is mapped to the corresponding QB tax item (or tax group) and to the QB tax code identified in the QBTaxGroup and QBTaxCode fields.
ITaxRecordList     Y

(List of ITaxRecord Objects)

       

TaxCategoryListID

The ListID of the tax category. This is always the same value as the tax category element. The list ID tag element, although redundant, helps to identify the use of this in object references.
IQBIDType   2.0 Y

TaxCategory

In the QBPOS UI, you specify sales tax behavior by creating sales tax locations and tax codes. (What the QBPOS UI calls a “tax location” is what the SDK calls a “tax category”.) The tax code and its name is shared between all tax categories (locations): that is, all tax categories will have the same set of tax codes. However, the actual tax rate(s) that are used in a given tax code can vary from one tax category to the next. The tax code rates that are actually applied at transaction time are those that are in the tax category that is currently specified as the default tax category (location) in sales tax preferences. You create and modify tax categories and tax codes using the TaxCategoryAdd/Mod and TaxCodeAdd/Mod requests respectively. You assign tax code rates to a tax code within a tax category using the TaxRecordMod request. You query for the tax preference information (tax rate information for each tax code under each tax category) using the CompanyQuery. However, currently the default tax category (location) can be specified only within the QBPOS UI. When you create or modify an inventory item in QBPOS, you apply a tax code to it, but not a tax category. At sales transaction time, the actual sales tax is calculated for each item, based on the tax code assigned to that item and the tax code rate(s) for that tax code under the tax category currently specified as the default tax category (location).
IQBStringType 20 chars    

POSTaxCodeListID

The list ID of the tax code. This is always the same as the tax code itself. It has its own element tag only to identify it as an object reference.
IQBIDType   2.0 Y

POSTaxCode

The tax code. This is the three-character maximum code, which is different from the (usually) longer tax code name that is displayed in the UI to provide a better “hint” for the user.
IQBStringType 3 chars    

TaxPercent

The tax rate for this tax, expressed as a percentage, eg, a value of 20.1 means the tax rate is 20.1%. If you are specifying a single tax rate, and thus are not using the TaxRate aggregate in the TaxRecordMod, you use the TaxPercent element that is at the first level in the Tax Record. If instead you are using the TaxPercent within the TaxRate aggregate (that is, you are specifying a multi-rate tax or a price-dependant single-rate tax), only the TaxPercent element within the Tax Rate(s) will be applied at transaction time.
IQBPercentType      

TaxRateList

When you construct a tax record mod request using qbposFC, and you use the TaxRate aggregate, you must append a TaxRate object to the TaxRateList object before proceeding to set the properties in that TaxRate.
ITaxRateList   2.0  

(List of ITaxRate Objects)

       

TaxPercent

The tax rate for this tax, expressed as a percentage, eg, a value of 20.1 means the tax rate is 20.1%. If you are specifying a single tax rate, and thus are not using the TaxRate aggregate in the TaxRecordMod, you use the TaxPercent element that is at the first level in the Tax Record. If instead you are using the TaxPercent within the TaxRate aggregate (that is, you are specifying a multi-rate tax or a price-dependant single-rate tax), only the TaxPercent element within the Tax Rate(s) will be applied at transaction time.
IQBPercentType      

TaxRateName

You should assign a tax rate name to each tax rate as this will help identify tax rates when you query for tax records using CompanyQuery.
IQBStringType 31 chars    

TaxAgency

The name of the tax authority to which the tax is to be paid.
IQBStringType      

TaxLowRange

The dollar amount at which the tax rate starts being applied.
IQBAmountType      

TaxHighRange

The dollar amount at which the tax rate stops being applied. By setting the TaxLowRange but leaving the TaxHighRange unset, you can specify that the tax rate starts at the TaxLowRange amount and continues to be taxed from that amount onward.
IQBAmountType      

IsTaxAppliedOnlyWithinRange

Specify the value True to apply the tax rate to the amount specified by TaxLowRange and TaxHighRange, and False if the tax is to be applied outside that amount range.
IQBBoolType      

QBTaxGroup

The QuickBooks tax group or tax item to which this QBPOS tax record is mapped. This field is available only if the QBPOS company is configured to be used with QuickBooks.
IQBStringType      

QBTaxGroup

The QuickBooks tax group or tax item to which this QBPOS tax record is mapped. This field is available only if the QBPOS company is configured to be used with QuickBooks.
IQBStringType      

QBTaxCode

The QuickBooks tax code to which this QBPOS tax code is mapped. This field is available only if the QBPOS company is configured to be used with QuickBooks.
IQBStringType      

DataExtRetList

If you specify any custom fields/private data extensions to be returned in the query request (in the OwnerIDList), then this Ret List will contain all of the data extensions that belong to each specified OwnerID. For example, if you specify an OwnerID value of 0 (custom fields), then the query will return all custom data for the returned records.
IDataExtRetList   1.2  

(List of IDataExtRet Objects)

       

OwnerID

OwnerID refers to the owner of a data extension, and must be 0 or a valid GUID. (Custom fields, which are visible in the QuickBooks UI, always have an OwnerID of 0. ) Usually you would keep your application’s GUID confidential to prevent other applications from accessing your data extensions. But if you want to share data extensions with another application, the applications need to use the same GUID. In this case, each application could use two GUIDs, one for shared data extensions and one for confidential data extensions. (An application can have any number of GUIDs.) When you share a data extension with another application, the other application must know both the OwnerID and the DataExtName, as these together form a data extension’s unique name.
IQBGUIDType     Y

DataExtName

The name of the data extension. If this is a custom field, DataExtName will be visible as a label in the QuickBooks user interface. Also because OwnerID and DataExtName together make the data extension unique, and because custom fields all have the same OwnerID of zero, the DataExtName must be a unique value among existing custom fields. In contrast, the DataExtName for private data extensions must be unique only for the specified OwnerID GUID.
IQBStringType     Y

DataExtType

b>DataExtType The type of the data extension.
IQBENDataExtTypeType     Y

DataExtValue

The data in this field. The maximum length of DataExtValue will depend on the DataExtType of this data extension. For example, if DataExtType is STR255TYPE, the maximum length of DataExtValue is 255 characters. If DataExtType is STR1024TYPE, the maximum size of DataExtValue is 1KB.
IQBStringType     Y

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?xml version="1.0" encoding="utf-8"?>
<?qbposxml version="4.0"?>
<QBPOSXML>
        <QBPOSXMLMsgsRq onError="stopOnError">
                <CompanyQueryRq>
                        <OwnerID >GUIDTYPE</OwnerID> <!-- optional, may repeat -->
                </CompanyQueryRq>

                <CompanyQueryRs statusCode="INTTYPE" statusSeverity="STRTYPE" statusMessage="STRTYPE">
                        <CompanyRet> <!-- optional -->
                                <IsSampleCompany >BOOLTYPE</IsSampleCompany> <!-- required -->
                                <CompanyName >STRTYPE</CompanyName> <!-- required -->
                                <Address> <!-- required -->
                                        <Street >STRTYPE</Street> <!-- required -->
                                        <CityStateZIP >STRTYPE</CityStateZIP> <!-- required -->
                                        <Misc1 >STRTYPE</Misc1> <!-- required -->
                                        <Misc2 >STRTYPE</Misc2> <!-- required -->
                                        <Misc3 >STRTYPE</Misc3> <!-- required -->
                                </Address>
                                <QuickBooksCompanyFile >STRTYPE</QuickBooksCompanyFile> <!-- optional -->
                                <StoreNumber >INTTYPE</StoreNumber> <!-- required -->
                                <StoreCode >INTTYPE</StoreCode> <!-- required -->
                                <Store> <!-- must occur 0 - 10 times -->
                                        <StoreNumber >INTTYPE</StoreNumber> <!-- required -->
                                        <StoreCode >INTTYPE</StoreCode> <!-- required -->
                                        <StoreName >STRTYPE</StoreName> <!-- required -->
                                        <Address> <!-- required -->
                                                <Street >STRTYPE</Street> <!-- required -->
                                                <CityStateZIP >STRTYPE</CityStateZIP> <!-- required -->
                                                <Misc1 >STRTYPE</Misc1> <!-- required -->
                                                <Misc2 >STRTYPE</Misc2> <!-- required -->
                                                <Misc3 >STRTYPE</Misc3> <!-- required -->
                                        </Address>
                                </Store>
                                <PriceLevel1> <!-- required -->
                                        <Name >STRTYPE</Name> <!-- required -->
                                        <Markdown >PERCENTTYPE</Markdown> <!-- required -->
                                </PriceLevel1>
                                <PriceLevel2> <!-- required -->
                                        <Name >STRTYPE</Name> <!-- required -->
                                        <Markdown >PERCENTTYPE</Markdown> <!-- required -->
                                </PriceLevel2>
                                <PriceLevel3> <!-- required -->
                                        <Name >STRTYPE</Name> <!-- required -->
                                        <Markdown >PERCENTTYPE</Markdown> <!-- required -->
                                </PriceLevel3>
                                <PriceLevel4> <!-- required -->
                                        <Name >STRTYPE</Name> <!-- required -->
                                        <Markdown >PERCENTTYPE</Markdown> <!-- required -->
                                </PriceLevel4>
                                <PriceLevel5> <!-- required -->
                                        <Name >STRTYPE</Name> <!-- required -->
                                        <Markdown >PERCENTTYPE</Markdown> <!-- required -->
                                </PriceLevel5>
                                <PurchaseOrderStatusInfo> <!-- required -->
                                        <OrderStatusData> <!-- required, may repeat -->
                                                <!-- StatusType may have one of the following values: Open, Closed, Custom -->
                                                <StatusType >ENUMTYPE</StatusType> <!-- required -->
                                                <StatusDescription >STRTYPE</StatusDescription> <!-- required -->
                                        </OrderStatusData>
                                </PurchaseOrderStatusInfo>
                                <LayawayStatusInfo> <!-- required -->
                                        <OrderStatusData> <!-- required, may repeat -->
                                                <!-- StatusType may have one of the following values: Open, Closed, Custom -->
                                                <StatusType >ENUMTYPE</StatusType> <!-- required -->
                                                <StatusDescription >STRTYPE</StatusDescription> <!-- required -->
                                        </OrderStatusData>
                                </LayawayStatusInfo>
                                <SalesOrderStatusInfo> <!-- required -->
                                        <OrderStatusData> <!-- required, may repeat -->
                                                <!-- StatusType may have one of the following values: Open, Closed, Custom -->
                                                <StatusType >ENUMTYPE</StatusType> <!-- required -->
                                                <StatusDescription >STRTYPE</StatusDescription> <!-- required -->
                                        </OrderStatusData>
                                </SalesOrderStatusInfo>
                                <WorkOrderStatusInfo> <!-- required -->
                                        <OrderStatusData> <!-- required, may repeat -->
                                                <!-- StatusType may have one of the following values: Open, Closed, Custom -->
                                                <StatusType >ENUMTYPE</StatusType> <!-- required -->
                                                <StatusDescription >STRTYPE</StatusDescription> <!-- required -->
                                        </OrderStatusData>
                                </WorkOrderStatusInfo>
                                <IsUsingUnitsOfMeasure >BOOLTYPE</IsUsingUnitsOfMeasure> <!-- required -->
                                <IsUsingIntegratedShipping >BOOLTYPE</IsUsingIntegratedShipping> <!-- required -->
                                <ShippingProvider >STRTYPE</ShippingProvider> <!-- optional, may repeat -->
                                <TaxRecord> <!-- required, may repeat -->
                                        <TaxCategoryListID >IDTYPE</TaxCategoryListID> <!-- required -->
                                        <TaxCategory >STRTYPE</TaxCategory> <!-- optional -->
                                        <POSTaxCodeListID >IDTYPE</POSTaxCodeListID> <!-- required -->
                                        <POSTaxCode >STRTYPE</POSTaxCode> <!-- optional -->
                                        <TaxPercent >PERCENTTYPE</TaxPercent> <!-- optional -->
                                        <TaxRate> <!-- must occur 0 - 3 times -->
                                                <TaxPercent >PERCENTTYPE</TaxPercent> <!-- optional -->
                                                <TaxRateName >STRTYPE</TaxRateName> <!-- optional -->
                                                <TaxAgency >STRTYPE</TaxAgency> <!-- optional -->
                                                <TaxLowRange >AMTTYPE</TaxLowRange> <!-- optional -->
                                                <TaxHighRange >AMTTYPE</TaxHighRange> <!-- optional -->
                                                <IsTaxAppliedOnlyWithinRange >BOOLTYPE</IsTaxAppliedOnlyWithinRange> <!-- optional -->
                                                <QBTaxGroup >STRTYPE</QBTaxGroup> <!-- optional -->
                                        </TaxRate>
                                        <QBTaxGroup >STRTYPE</QBTaxGroup> <!-- optional -->
                                        <QBTaxCode >STRTYPE</QBTaxCode> <!-- optional -->
                                </TaxRecord>
                                <DataExtRet> <!-- optional, may repeat -->
                                        <OwnerID >GUIDTYPE</OwnerID> <!-- required -->
                                        <DataExtName >STRTYPE</DataExtName> <!-- required -->
                                        <!-- DataExtType may have one of the following values: INTTYPE, AMTTYPE, PRICETYPE, QUANTYPE, PERCENTTYPE, DATETIMETYPE, STR255TYPE, STR1024TYPE -->
                                        <DataExtType >ENUMTYPE</DataExtType> <!-- required -->
                                        <DataExtValue >STRTYPE</DataExtValue> <!-- required -->
                                </DataExtRet>
                        </CompanyRet>
                </CompanyQueryRs>
        </QBPOSXMLMsgsRq>
</QBPOSXML>

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
'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.qbposfc4

        Public Class SampleCompanyQuery
                Public Sub  DoCompanyQuery()
                        Dim sessionBegun as Boolean
                        sessionBegun = False
                        Dim connectionOpen as Boolean
                        connectionOpen = False
                        Dim sessionManager as QBPOSSessionManager
                        sessionManager = nothing

                        Try
                                'Create the session Manager object
                                sessionManager = new QBPOSSessionManager

                                'Create the message set request object to hold our request
                                Dim requestMsgSet as IMsgSetRequest
                                requestMsgSet = sessionManager.CreateMsgSetRequest(4,0)
                                requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue

                                BuildCompanyQueryRq(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
                                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

                                WalkCompanyQueryRs(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
                End Sub
                Public Sub BuildCompanyQueryRq(requestMsgSet as IMsgSetRequest)
                        Dim CompanyQueryRq as ICompanyQuery
                        CompanyQueryRq= requestMsgSet.AppendCompanyQueryRq()
                        'Set field value for OwnerIDList
                        'May create more than one of these if needed
                        CompanyQueryRq.OwnerIDList.Add(System.Guid.NewGuid().ToString())
                End Sub




                Public Sub WalkCompanyQueryRs( 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.rtCompanyQueryRs) then
                                                        'upcast to more specific type here, this is safe because we checked with response.Type check above
                                                        Dim CompanyRet as ICompanyRet
                                                        CompanyRet = CType(response.Detail,ICompanyRet)
                                                                WalkCompanyRet(CompanyRet)
                                                End If
                                        End If
                                End If
                        Next j
                End Sub




                Public Sub WalkCompanyRet(CompanyRet as ICompanyRet)
                        if (CompanyRet is nothing) then
                                Exit Sub
                        End If

                        'Go through all the elements of ICompanyRet
                        'Get value of IsSampleCompany
                        Dim IsSampleCompany1 as Boolean
                        IsSampleCompany1 = CompanyRet.IsSampleCompany.GetValue()
                        'Get value of CompanyName
                        Dim CompanyName2 as String
                        CompanyName2 = CompanyRet.CompanyName.GetValue()
                        'Get value of Street
                        Dim Street3 as String
                        Street3 = CompanyRet.Address.Street.GetValue()
                        'Get value of CityStateZIP
                        Dim CityStateZIP4 as String
                        CityStateZIP4 = CompanyRet.Address.CityStateZIP.GetValue()
                        'Get value of Misc1
                        Dim Misc15 as String
                        Misc15 = CompanyRet.Address.Misc1.GetValue()
                        'Get value of Misc2
                        Dim Misc26 as String
                        Misc26 = CompanyRet.Address.Misc2.GetValue()
                        'Get value of Misc3
                        Dim Misc37 as String
                        Misc37 = CompanyRet.Address.Misc3.GetValue()
                        'Get value of QuickBooksCompanyFile
                        if ( not CompanyRet.QuickBooksCompanyFile is nothing) then
                                Dim QuickBooksCompanyFile8 as String
                                QuickBooksCompanyFile8 = CompanyRet.QuickBooksCompanyFile.GetValue()
                        End If
                        'Get value of StoreNumber
                        Dim StoreNumber9 as Integer
                        StoreNumber9 = CompanyRet.StoreNumber.GetValue()
                        'Get value of StoreCode
                        Dim StoreCode10 as Integer
                        StoreCode10 = CompanyRet.StoreCode.GetValue()
                        if (not CompanyRet.StoreList is nothing)
                                Dim i11 as Integer
                                for i11 = 0  to CompanyRet.StoreList.Count - 1
                                        Dim Store as IStore
                                        Store = CompanyRet.StoreList.GetAt(i11)
                                        'Get value of StoreNumber
                                        Dim StoreNumber12 as Integer
                                        StoreNumber12 = Store.StoreNumber.GetValue()
                                        'Get value of StoreCode
                                        Dim StoreCode13 as Integer
                                        StoreCode13 = Store.StoreCode.GetValue()
                                        'Get value of StoreName
                                        Dim StoreName14 as String
                                        StoreName14 = Store.StoreName.GetValue()
                                        'Get value of Street
                                        Dim Street15 as String
                                        Street15 = Store.Address.Street.GetValue()
                                        'Get value of CityStateZIP
                                        Dim CityStateZIP16 as String
                                        CityStateZIP16 = Store.Address.CityStateZIP.GetValue()
                                        'Get value of Misc1
                                        Dim Misc117 as String
                                        Misc117 = Store.Address.Misc1.GetValue()
                                        'Get value of Misc2
                                        Dim Misc218 as String
                                        Misc218 = Store.Address.Misc2.GetValue()
                                        'Get value of Misc3
                                        Dim Misc319 as String
                                        Misc319 = Store.Address.Misc3.GetValue()
                                Next i11
                        End If
                        'Get value of Name
                        Dim Name20 as String
                        Name20 = CompanyRet.PriceLevel1.Name.GetValue()
                        'Get value of Markdown
                        Dim Markdown21 as Double
                        Markdown21 = CompanyRet.PriceLevel1.Markdown.GetValue()
                        'Get value of Name
                        Dim Name22 as String
                        Name22 = CompanyRet.PriceLevel2.Name.GetValue()
                        'Get value of Markdown
                        Dim Markdown23 as Double
                        Markdown23 = CompanyRet.PriceLevel2.Markdown.GetValue()
                        'Get value of Name
                        Dim Name24 as String
                        Name24 = CompanyRet.PriceLevel3.Name.GetValue()
                        'Get value of Markdown
                        Dim Markdown25 as Double
                        Markdown25 = CompanyRet.PriceLevel3.Markdown.GetValue()
                        'Get value of Name
                        Dim Name26 as String
                        Name26 = CompanyRet.PriceLevel4.Name.GetValue()
                        'Get value of Markdown
                        Dim Markdown27 as Double
                        Markdown27 = CompanyRet.PriceLevel4.Markdown.GetValue()
                        'Get value of Name
                        Dim Name28 as String
                        Name28 = CompanyRet.PriceLevel5.Name.GetValue()
                        'Get value of Markdown
                        Dim Markdown29 as Double
                        Markdown29 = CompanyRet.PriceLevel5.Markdown.GetValue()
                        if (not CompanyRet.PurchaseOrderStatusInfo.OrderStatusDataList is nothing)
                                Dim i30 as Integer
                                for i30 = 0  to CompanyRet.PurchaseOrderStatusInfo.OrderStatusDataList.Count - 1
                                        Dim OrderStatusData as IOrderStatusData
                                        OrderStatusData = CompanyRet.PurchaseOrderStatusInfo.OrderStatusDataList.GetAt(i30)
                                        'Get value of StatusType
                                        Dim StatusType31 as ENStatusType
                                        StatusType31 = OrderStatusData.StatusType.GetValue()
                                        'Get value of StatusDescription
                                        Dim StatusDescription32 as String
                                        StatusDescription32 = OrderStatusData.StatusDescription.GetValue()
                                Next i30
                        End If
                        if (not CompanyRet.LayawayStatusInfo.OrderStatusDataList is nothing)
                                Dim i33 as Integer
                                for i33 = 0  to CompanyRet.LayawayStatusInfo.OrderStatusDataList.Count - 1
                                        Dim OrderStatusData as IOrderStatusData
                                        OrderStatusData = CompanyRet.LayawayStatusInfo.OrderStatusDataList.GetAt(i33)
                                        'Get value of StatusType
                                        Dim StatusType34 as ENStatusType
                                        StatusType34 = OrderStatusData.StatusType.GetValue()
                                        'Get value of StatusDescription
                                        Dim StatusDescription35 as String
                                        StatusDescription35 = OrderStatusData.StatusDescription.GetValue()
                                Next i33
                        End If
                        if (not CompanyRet.SalesOrderStatusInfo.OrderStatusDataList is nothing)
                                Dim i36 as Integer
                                for i36 = 0  to CompanyRet.SalesOrderStatusInfo.OrderStatusDataList.Count - 1
                                        Dim OrderStatusData as IOrderStatusData
                                        OrderStatusData = CompanyRet.SalesOrderStatusInfo.OrderStatusDataList.GetAt(i36)
                                        'Get value of StatusType
                                        Dim StatusType37 as ENStatusType
                                        StatusType37 = OrderStatusData.StatusType.GetValue()
                                        'Get value of StatusDescription
                                        Dim StatusDescription38 as String
                                        StatusDescription38 = OrderStatusData.StatusDescription.GetValue()
                                Next i36
                        End If
                        if (not CompanyRet.WorkOrderStatusInfo.OrderStatusDataList is nothing)
                                Dim i39 as Integer
                                for i39 = 0  to CompanyRet.WorkOrderStatusInfo.OrderStatusDataList.Count - 1
                                        Dim OrderStatusData as IOrderStatusData
                                        OrderStatusData = CompanyRet.WorkOrderStatusInfo.OrderStatusDataList.GetAt(i39)
                                        'Get value of StatusType
                                        Dim StatusType40 as ENStatusType
                                        StatusType40 = OrderStatusData.StatusType.GetValue()
                                        'Get value of StatusDescription
                                        Dim StatusDescription41 as String
                                        StatusDescription41 = OrderStatusData.StatusDescription.GetValue()
                                Next i39
                        End If
                        'Get value of IsUsingUnitsOfMeasure
                        Dim IsUsingUnitsOfMeasure42 as Boolean
                        IsUsingUnitsOfMeasure42 = CompanyRet.IsUsingUnitsOfMeasure.GetValue()
                        'Get value of IsUsingIntegratedShipping
                        Dim IsUsingIntegratedShipping43 as Boolean
                        IsUsingIntegratedShipping43 = CompanyRet.IsUsingIntegratedShipping.GetValue()
                        'Get value of ShippingProviderList
                        if ( not CompanyRet.ShippingProviderList is nothing) then
                                Dim ShippingProvider44 as String
                                ShippingProvider44 = CompanyRet.ShippingProviderList.GetAt(0)
                        End If
                        if (not CompanyRet.TaxRecordList is nothing)
                                Dim i45 as Integer
                                for i45 = 0  to CompanyRet.TaxRecordList.Count - 1
                                        Dim TaxRecord as ITaxRecord
                                        TaxRecord = CompanyRet.TaxRecordList.GetAt(i45)
                                        'Get value of TaxCategoryListID
                                        Dim TaxCategoryListID46 as String
                                        TaxCategoryListID46 = TaxRecord.TaxCategoryListID.GetValue()
                                        'Get value of TaxCategory
                                        if ( not TaxRecord.TaxCategory is nothing) then
                                                Dim TaxCategory47 as String
                                                TaxCategory47 = TaxRecord.TaxCategory.GetValue()
                                        End If
                                        'Get value of POSTaxCodeListID
                                        Dim POSTaxCodeListID48 as String
                                        POSTaxCodeListID48 = TaxRecord.POSTaxCodeListID.GetValue()
                                        'Get value of POSTaxCode
                                        if ( not TaxRecord.POSTaxCode is nothing) then
                                                Dim POSTaxCode49 as String
                                                POSTaxCode49 = TaxRecord.POSTaxCode.GetValue()
                                        End If
                                        'Get value of TaxPercent
                                        if ( not TaxRecord.TaxPercent is nothing) then
                                                Dim TaxPercent50 as Double
                                                TaxPercent50 = TaxRecord.TaxPercent.GetValue()
                                        End If
                                        if (not TaxRecord.TaxRateList is nothing)
                                                Dim i51 as Integer
                                                for i51 = 0  to TaxRecord.TaxRateList.Count - 1
                                                        Dim TaxRate as ITaxRate
                                                        TaxRate = TaxRecord.TaxRateList.GetAt(i51)
                                                        'Get value of TaxPercent
                                                        if ( not TaxRate.TaxPercent is nothing) then
                                                                Dim TaxPercent52 as Double
                                                                TaxPercent52 = TaxRate.TaxPercent.GetValue()
                                                        End If
                                                        'Get value of TaxRateName
                                                        if ( not TaxRate.TaxRateName is nothing) then
                                                                Dim TaxRateName53 as String
                                                                TaxRateName53 = TaxRate.TaxRateName.GetValue()
                                                        End If
                                                        'Get value of TaxAgency
                                                        if ( not TaxRate.TaxAgency is nothing) then
                                                                Dim TaxAgency54 as String
                                                                TaxAgency54 = TaxRate.TaxAgency.GetValue()
                                                        End If
                                                        'Get value of TaxLowRange
                                                        if ( not TaxRate.TaxLowRange is nothing) then
                                                                Dim TaxLowRange55 as Double
                                                                TaxLowRange55 = TaxRate.TaxLowRange.GetValue()
                                                        End If
                                                        'Get value of TaxHighRange
                                                        if ( not TaxRate.TaxHighRange is nothing) then
                                                                Dim TaxHighRange56 as Double
                                                                TaxHighRange56 = TaxRate.TaxHighRange.GetValue()
                                                        End If
                                                        'Get value of IsTaxAppliedOnlyWithinRange
                                                        if ( not TaxRate.IsTaxAppliedOnlyWithinRange is nothing) then
                                                                Dim IsTaxAppliedOnlyWithinRange57 as Boolean
                                                                IsTaxAppliedOnlyWithinRange57 = TaxRate.IsTaxAppliedOnlyWithinRange.GetValue()
                                                        End If
                                                        'Get value of QBTaxGroup
                                                        if ( not TaxRate.QBTaxGroup is nothing) then
                                                                Dim QBTaxGroup58 as String
                                                                QBTaxGroup58 = TaxRate.QBTaxGroup.GetValue()
                                                        End If
                                                Next i51
                                        End If
                                        'Get value of QBTaxGroup
                                        if ( not TaxRecord.QBTaxGroup is nothing) then
                                                Dim QBTaxGroup59 as String
                                                QBTaxGroup59 = TaxRecord.QBTaxGroup.GetValue()
                                        End If
                                        'Get value of QBTaxCode
                                        if ( not TaxRecord.QBTaxCode is nothing) then
                                                Dim QBTaxCode60 as String
                                                QBTaxCode60 = TaxRecord.QBTaxCode.GetValue()
                                        End If
                                Next i45
                        End If
                        if (not CompanyRet.DataExtRetList is nothing)
                                Dim i61 as Integer
                                for i61 = 0  to CompanyRet.DataExtRetList.Count - 1
                                        Dim DataExtRet as IDataExtRet
                                        DataExtRet = CompanyRet.DataExtRetList.GetAt(i61)
                                        'Get value of OwnerID
                                        Dim OwnerID62 as String
                                        OwnerID62 = DataExtRet.OwnerID.GetValue()
                                        'Get value of DataExtName
                                        Dim DataExtName63 as String
                                        DataExtName63 = DataExtRet.DataExtName.GetValue()
                                        'Get value of DataExtType
                                        Dim DataExtType64 as ENDataExtType
                                        DataExtType64 = DataExtRet.DataExtType.GetValue()
                                        'Get value of DataExtValue
                                        Dim DataExtValue65 as String
                                        DataExtValue65 = DataExtRet.DataExtValue.GetValue()
                                Next i61
                        End If
                End Sub




        End Class

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
//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;

namespace com.intuit.idn.samples
{
        public class SampleCompanyQuery
        {
                public void  DoCompanyQuery()
                {
                        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;

                                BuildCompanyQueryRq(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;

                                WalkCompanyQueryRs(responseMsgSet);
                        }
                        catch (Exception e)
                        {
                                MessageBox.Show(e.Message, "Error");
                                if (sessionBegun)
                                {
                                        sessionManager.EndSession();
                                }
                                if (connectionOpen)
                                {
                                        sessionManager.CloseConnection();
                                }
                        }
                }
                void BuildCompanyQueryRq(IMsgSetRequest requestMsgSet)
                {
                        ICompanyQuery CompanyQueryRq= requestMsgSet.AppendCompanyQueryRq();
                        //Set field value for OwnerIDList
                        //May create more than one of these if needed
                        CompanyQueryRq.OwnerIDList.Add(Guid.NewGuid().ToString());
                }




                void WalkCompanyQueryRs(IMsgSetResponse responseMsgSet)
                {
                        if (responseMsgSet == null) return;
                        IResponseList responseList = responseMsgSet.ResponseList;
                        if (responseList == null) return;
                        //if we sent only one request, there is only one response, we'll walk the list for this sample
                        for(int i=0; i < responseList.Count; i++)
                        {
                                IResponse response = responseList.GetAt(i);
                                //check the status code of the response, 0=ok, >0 is warning
                                if (response.StatusCode >= 0)
                                {
                                        //the request-specific response is in the details, make sure we have some
                                        if (response.Detail != null)
                                        {
                                                //make sure the response is the type we're expecting
                                                ENResponseType responseType = (ENResponseType)response.Type.GetValue();
                                                if (responseType == ENResponseType.rtCompanyQueryRs)
                                                {
                                                        //upcast to more specific type here, this is safe because we checked with response.Type check above
                                                        ICompanyRet CompanyRet = (ICompanyRet)response.Detail;
                                                                WalkCompanyRet(CompanyRet);
                                                }
                                        }
                                }
                        }
                }




                void WalkCompanyRet(ICompanyRet CompanyRet)
                {
                        if (CompanyRet == null) return;
                        //Go through all the elements of ICompanyRet
                        //Get value of IsSampleCompany
                        bool IsSampleCompany66 = (bool)CompanyRet.IsSampleCompany.GetValue();
                        //Get value of CompanyName
                        string CompanyName67 = (string)CompanyRet.CompanyName.GetValue();
                        //Get value of Street
                        string Street68 = (string)CompanyRet.Address.Street.GetValue();
                        //Get value of CityStateZIP
                        string CityStateZIP69 = (string)CompanyRet.Address.CityStateZIP.GetValue();
                        //Get value of Misc1
                        string Misc170 = (string)CompanyRet.Address.Misc1.GetValue();
                        //Get value of Misc2
                        string Misc271 = (string)CompanyRet.Address.Misc2.GetValue();
                        //Get value of Misc3
                        string Misc372 = (string)CompanyRet.Address.Misc3.GetValue();
                        //Get value of QuickBooksCompanyFile
                        if (CompanyRet.QuickBooksCompanyFile != null)
                        {
                                string QuickBooksCompanyFile73 = (string)CompanyRet.QuickBooksCompanyFile.GetValue();
                        }
                        //Get value of StoreNumber
                        int StoreNumber74 = (int)CompanyRet.StoreNumber.GetValue();
                        //Get value of StoreCode
                        int StoreCode75 = (int)CompanyRet.StoreCode.GetValue();
                        if (CompanyRet.StoreList != null)
                        {
                                for (int i76 = 0; i76 < CompanyRet.StoreList.Count; i76++)
                                {
                                        IStore Store = CompanyRet.StoreList.GetAt(i76);
                                        //Get value of StoreNumber
                                        int StoreNumber77 = (int)Store.StoreNumber.GetValue();
                                        //Get value of StoreCode
                                        int StoreCode78 = (int)Store.StoreCode.GetValue();
                                        //Get value of StoreName
                                        string StoreName79 = (string)Store.StoreName.GetValue();
                                        //Get value of Street
                                        string Street80 = (string)Store.Address.Street.GetValue();
                                        //Get value of CityStateZIP
                                        string CityStateZIP81 = (string)Store.Address.CityStateZIP.GetValue();
                                        //Get value of Misc1
                                        string Misc182 = (string)Store.Address.Misc1.GetValue();
                                        //Get value of Misc2
                                        string Misc283 = (string)Store.Address.Misc2.GetValue();
                                        //Get value of Misc3
                                        string Misc384 = (string)Store.Address.Misc3.GetValue();
                                }
                        }
                        //Get value of Name
                        string Name85 = (string)CompanyRet.PriceLevel1.Name.GetValue();
                        //Get value of Markdown
                        double Markdown86 = (double)CompanyRet.PriceLevel1.Markdown.GetValue();
                        //Get value of Name
                        string Name87 = (string)CompanyRet.PriceLevel2.Name.GetValue();
                        //Get value of Markdown
                        double Markdown88 = (double)CompanyRet.PriceLevel2.Markdown.GetValue();
                        //Get value of Name
                        string Name89 = (string)CompanyRet.PriceLevel3.Name.GetValue();
                        //Get value of Markdown
                        double Markdown90 = (double)CompanyRet.PriceLevel3.Markdown.GetValue();
                        //Get value of Name
                        string Name91 = (string)CompanyRet.PriceLevel4.Name.GetValue();
                        //Get value of Markdown
                        double Markdown92 = (double)CompanyRet.PriceLevel4.Markdown.GetValue();
                        //Get value of Name
                        string Name93 = (string)CompanyRet.PriceLevel5.Name.GetValue();
                        //Get value of Markdown
                        double Markdown94 = (double)CompanyRet.PriceLevel5.Markdown.GetValue();
                        if (CompanyRet.PurchaseOrderStatusInfo.OrderStatusDataList != null)
                        {
                                for (int i95 = 0; i95 < CompanyRet.PurchaseOrderStatusInfo.OrderStatusDataList.Count; i95++)
                                {
                                        IOrderStatusData OrderStatusData = CompanyRet.PurchaseOrderStatusInfo.OrderStatusDataList.GetAt(i95);
                                        //Get value of StatusType
                                        ENStatusType StatusType96 = (ENStatusType)OrderStatusData.StatusType.GetValue();
                                        //Get value of StatusDescription
                                        string StatusDescription97 = (string)OrderStatusData.StatusDescription.GetValue();
                                }
                        }
                        if (CompanyRet.LayawayStatusInfo.OrderStatusDataList != null)
                        {
                                for (int i98 = 0; i98 < CompanyRet.LayawayStatusInfo.OrderStatusDataList.Count; i98++)
                                {
                                        IOrderStatusData OrderStatusData = CompanyRet.LayawayStatusInfo.OrderStatusDataList.GetAt(i98);
                                        //Get value of StatusType
                                        ENStatusType StatusType99 = (ENStatusType)OrderStatusData.StatusType.GetValue();
                                        //Get value of StatusDescription
                                        string StatusDescription100 = (string)OrderStatusData.StatusDescription.GetValue();
                                }
                        }
                        if (CompanyRet.SalesOrderStatusInfo.OrderStatusDataList != null)
                        {
                                for (int i101 = 0; i101 < CompanyRet.SalesOrderStatusInfo.OrderStatusDataList.Count; i101++)
                                {
                                        IOrderStatusData OrderStatusData = CompanyRet.SalesOrderStatusInfo.OrderStatusDataList.GetAt(i101);
                                        //Get value of StatusType
                                        ENStatusType StatusType102 = (ENStatusType)OrderStatusData.StatusType.GetValue();
                                        //Get value of StatusDescription
                                        string StatusDescription103 = (string)OrderStatusData.StatusDescription.GetValue();
                                }
                        }
                        if (CompanyRet.WorkOrderStatusInfo.OrderStatusDataList != null)
                        {
                                for (int i104 = 0; i104 < CompanyRet.WorkOrderStatusInfo.OrderStatusDataList.Count; i104++)
                                {
                                        IOrderStatusData OrderStatusData = CompanyRet.WorkOrderStatusInfo.OrderStatusDataList.GetAt(i104);
                                        //Get value of StatusType
                                        ENStatusType StatusType105 = (ENStatusType)OrderStatusData.StatusType.GetValue();
                                        //Get value of StatusDescription
                                        string StatusDescription106 = (string)OrderStatusData.StatusDescription.GetValue();
                                }
                        }
                        //Get value of IsUsingUnitsOfMeasure
                        bool IsUsingUnitsOfMeasure107 = (bool)CompanyRet.IsUsingUnitsOfMeasure.GetValue();
                        //Get value of IsUsingIntegratedShipping
                        bool IsUsingIntegratedShipping108 = (bool)CompanyRet.IsUsingIntegratedShipping.GetValue();
                        //Get value of ShippingProviderList
                        if (CompanyRet.ShippingProviderList != null)
                        {
                                string ShippingProvider109 = (string)CompanyRet.ShippingProviderList.GetAt(0);
                        }
                        if (CompanyRet.TaxRecordList != null)
                        {
                                for (int i110 = 0; i110 < CompanyRet.TaxRecordList.Count; i110++)
                                {
                                        ITaxRecord TaxRecord = CompanyRet.TaxRecordList.GetAt(i110);
                                        //Get value of TaxCategoryListID
                                        string TaxCategoryListID111 = (string)TaxRecord.TaxCategoryListID.GetValue();
                                        //Get value of TaxCategory
                                        if (TaxRecord.TaxCategory != null)
                                        {
                                                string TaxCategory112 = (string)TaxRecord.TaxCategory.GetValue();
                                        }
                                        //Get value of POSTaxCodeListID
                                        string POSTaxCodeListID113 = (string)TaxRecord.POSTaxCodeListID.GetValue();
                                        //Get value of POSTaxCode
                                        if (TaxRecord.POSTaxCode != null)
                                        {
                                                string POSTaxCode114 = (string)TaxRecord.POSTaxCode.GetValue();
                                        }
                                        //Get value of TaxPercent
                                        if (TaxRecord.TaxPercent != null)
                                        {
                                                double TaxPercent115 = (double)TaxRecord.TaxPercent.GetValue();
                                        }
                                        if (TaxRecord.TaxRateList != null)
                                        {
                                                for (int i116 = 0; i116 < TaxRecord.TaxRateList.Count; i116++)
                                                {
                                                        ITaxRate TaxRate = TaxRecord.TaxRateList.GetAt(i116);
                                                        //Get value of TaxPercent
                                                        if (TaxRate.TaxPercent != null)
                                                        {
                                                                double TaxPercent117 = (double)TaxRate.TaxPercent.GetValue();
                                                        }
                                                        //Get value of TaxRateName
                                                        if (TaxRate.TaxRateName != null)
                                                        {
                                                                string TaxRateName118 = (string)TaxRate.TaxRateName.GetValue();
                                                        }
                                                        //Get value of TaxAgency
                                                        if (TaxRate.TaxAgency != null)
                                                        {
                                                                string TaxAgency119 = (string)TaxRate.TaxAgency.GetValue();
                                                        }
                                                        //Get value of TaxLowRange
                                                        if (TaxRate.TaxLowRange != null)
                                                        {
                                                                double TaxLowRange120 = (double)TaxRate.TaxLowRange.GetValue();
                                                        }
                                                        //Get value of TaxHighRange
                                                        if (TaxRate.TaxHighRange != null)
                                                        {
                                                                double TaxHighRange121 = (double)TaxRate.TaxHighRange.GetValue();
                                                        }
                                                        //Get value of IsTaxAppliedOnlyWithinRange
                                                        if (TaxRate.IsTaxAppliedOnlyWithinRange != null)
                                                        {
                                                                bool IsTaxAppliedOnlyWithinRange122 = (bool)TaxRate.IsTaxAppliedOnlyWithinRange.GetValue();
                                                        }
                                                        //Get value of QBTaxGroup
                                                        if (TaxRate.QBTaxGroup != null)
                                                        {
                                                                string QBTaxGroup123 = (string)TaxRate.QBTaxGroup.GetValue();
                                                        }
                                                }
                                        }
                                        //Get value of QBTaxGroup
                                        if (TaxRecord.QBTaxGroup != null)
                                        {
                                                string QBTaxGroup124 = (string)TaxRecord.QBTaxGroup.GetValue();
                                        }
                                        //Get value of QBTaxCode
                                        if (TaxRecord.QBTaxCode != null)
                                        {
                                                string QBTaxCode125 = (string)TaxRecord.QBTaxCode.GetValue();
                                        }
                                }
                        }
                        if (CompanyRet.DataExtRetList != null)
                        {
                                for (int i126 = 0; i126 < CompanyRet.DataExtRetList.Count; i126++)
                                {
                                        IDataExtRet DataExtRet = CompanyRet.DataExtRetList.GetAt(i126);
                                        //Get value of OwnerID
                                        string OwnerID127 = (string)DataExtRet.OwnerID.GetValue();
                                        //Get value of DataExtName
                                        string DataExtName128 = (string)DataExtRet.DataExtName.GetValue();
                                        //Get value of DataExtType
                                        ENDataExtType DataExtType129 = (ENDataExtType)DataExtRet.DataExtType.GetValue();
                                        //Get value of DataExtValue
                                        string DataExtValue130 = (string)DataExtRet.DataExtValue.GetValue();
                                }
                        }
                }




        }
}