CompanyQuery

A CompanyQueryRq request message returns detailed information about a QuickBooks company file, such as the company’s address and legal name, certain preferences that are set, and any services that the company is subscribed to, such as payroll, QuickBooks Merchant Services, and so forth. Company information cannot be added or modified through the SDK, only through the QuickBooks user interface. Note: If you include an explicit end tag in a CompanyQueryRq request, you will receive an error if there is any space between the opening tag and the end tag. The following table shows valid and invalid ways of constructing this request:

Valid
(no space between opening and closing tags)
Valid

(combined opening and closing tag)
Invalid
(space between opening and closing tags)

Request

Response

XMLOps

VB.NET

C#

Tag Type Max length Implementation Required

ICompanyQuery

A CompanyQueryRq request message returns detailed information about a QuickBooks company file, such as the company’s address and legal name, certain preferences that are set, and any services that the company is subscribed to, such as payroll, QuickBooks Merchant Services, and so forth. Company information cannot be added or modified through the SDK, only through the QuickBooks user interface. Note: If you include an explicit end tag in a CompanyQueryRq request, you will receive an error if there is any space between the opening tag and the end tag. The following table shows valid and invalid ways of constructing this request:Valid(no space between opening and closing tags) Valid(combined opening and closing tag) Invalid (space between opening and closing tags)
       

IncludeRetElementList

You use this if you want to limit the data that will be returned in the response. In this list, you specify the name of each top-level element or aggregate that you want to be returned in the response to the request. You cannot specify fields within an aggregate, for example, you cannot specify a City within an Address: you must specify Address and will get the entire address. The names specified in the list are not parsed, so you must be especially careful to supply valid names, properly cased. No error is returned in the status code if you specify an invalid name. Notice that if you want to return custom data or private data extensions, you must specify the DataExtRet element and you must supply the OwnerID set to either a value of 0 (custom data) or the GUID for the private data.
IBSTRList 50 chars 4.0  

OwnerIDList

Zero or more OwnerID values. OwnerID refers to the owner of a data extension:If OwnerID is 0, this is a public data extension, also known as a custom field. Custom fields appear in the QuickBooks UI.If OwnerID is a GUID, for example {6B063959-81B0-4622-85D6-F548C8CCB517}, this field is a private data extension defined by an integrated application. Private data extensions do not appear in the QuickBooks UI. 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   2.0  
Tag Type Max length Implementation Required

IResponse

A CompanyQueryRq request message returns detailed information about a QuickBooks company file, such as the company’s address and legal name, certain preferences that are set, and any services that the company is subscribed to, such as payroll, QuickBooks Merchant Services, and so forth. Company information cannot be added or modified through the SDK, only through the QuickBooks user interface. Note: If you include an explicit end tag in a CompanyQueryRq request, you will receive an error if there is any space between the opening tag and the end tag. The following table shows valid and invalid ways of constructing this request:Valid(no space between opening and closing tags) Valid(combined opening and closing tag) Invalid (space between opening and closing tags)
       

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   3.0 Y

CompanyName

The name of the QuickBooks user’s business, as specified in QuickBooks. CompanyName and Address are used on invoices, checks, and other forms. (LegalCompanyName and LegalAddress, on the other hand, are used on a company’s tax forms and pay stubs.)
IQBStringType 59 chars    

LegalCompanyName

LegalCompanyName and LegalAddress are used on a company’s tax forms and pay stubs. (CompanyName and Address, on the other hand, are used on invoices, checks, and other forms.)
IQBStringType 59 chars    

Address

If an address request fails, some combination of address fields might be too long. In a Check, BillPaymentCheck, or SalesTaxPaymentCheck message, Address is the address that will print on the check.
IAddress      

Addr1

The first line of an address.
IQBStringType 41 chars    

Addr2

The second line of an address (if a second line is needed).
IQBStringType 41 chars    

Addr3

The third line of an address (if a third line is needed).
IQBStringType 41 chars    

Addr4

The fourth line of an address (if a fourth line is needed).
IQBStringType 41 chars 2.0  

Addr5

The fifth line of an address (if a fifth line is needed).
IQBStringType 41 chars 6.0  

City

The city name in an address.
IQBStringType 31 chars    

State

The state name in an address.
IQBStringType 21 chars    

PostalCode

The postal code in an address.
IQBStringType 13 chars    

Country

The country name in an address, or, in returned Host information (HostRet or HostInfo), the country for which this edition of QuickBooks was designed. (Possible values are US, CA, UK, and AU.)
IQBStringType 31 chars    

Note

In a BillAddress or ShipAddress aggregate, the Note field value is written at the bottom of the address in the form in which it appears, such as the invoice form.
IQBStringType 41 chars 6.0  

AddressBlock

The address expressed as an address block of Addr1 through Addr5, depending on the number of lines in the original request that created the address.
IAddressBlock   6.0  

Addr1

The first line of an address.
IQBStringType 41 chars    

Addr2

The second line of an address (if a second line is needed).
IQBStringType 41 chars    

Addr3

The third line of an address (if a third line is needed).
IQBStringType 41 chars    

Addr4

The fourth line of an address (if a fourth line is needed).
IQBStringType 41 chars    

Addr5

The fifth line of an address (if a fifth line is needed).
IQBStringType 41 chars    

LegalAddress

LegalAddress and LegalCompanyName are used on a company’s tax forms and pay stubs. (Address and CompanyName, on the other hand, are used on invoices, checks, and other forms.) If an address request fails, some combination of address fields might be too long.
IAddress      

Addr1

The first line of an address.
IQBStringType 41 chars    

Addr2

The second line of an address (if a second line is needed).
IQBStringType 41 chars    

Addr3

The third line of an address (if a third line is needed).
IQBStringType 41 chars    

Addr4

The fourth line of an address (if a fourth line is needed).
IQBStringType 41 chars 2.0  

Addr5

The fifth line of an address (if a fifth line is needed).
IQBStringType 41 chars 6.0  

City

The city name in an address.
IQBStringType 31 chars    

State

The state name in an address.
IQBStringType 21 chars    

PostalCode

The postal code in an address.
IQBStringType 13 chars    

Country

The country name in an address, or, in returned Host information (HostRet or HostInfo), the country for which this edition of QuickBooks was designed. (Possible values are US, CA, UK, and AU.)
IQBStringType 31 chars    

Note

In a BillAddress or ShipAddress aggregate, the Note field value is written at the bottom of the address in the form in which it appears, such as the invoice form.
IQBStringType 41 chars 6.0  

CompanyAddressForCustomer

The address where a QuickBooks company receives mail from its customers. If an address request fails, some combination of address fields might be too long.
IAddress      

Addr1

The first line of an address.
IQBStringType 41 chars    

Addr2

The second line of an address (if a second line is needed).
IQBStringType 41 chars    

Addr3

The third line of an address (if a third line is needed).
IQBStringType 41 chars    

Addr4

The fourth line of an address (if a fourth line is needed).
IQBStringType 41 chars 2.0  

Addr5

The fifth line of an address (if a fifth line is needed).
IQBStringType 41 chars 6.0  

City

The city name in an address.
IQBStringType 31 chars    

State

The state name in an address.
IQBStringType 21 chars    

PostalCode

The postal code in an address.
IQBStringType 13 chars    

Country

The country name in an address, or, in returned Host information (HostRet or HostInfo), the country for which this edition of QuickBooks was designed. (Possible values are US, CA, UK, and AU.)
IQBStringType 31 chars    

Note

In a BillAddress or ShipAddress aggregate, the Note field value is written at the bottom of the address in the form in which it appears, such as the invoice form.
IQBStringType 41 chars 6.0  

CompanyAddressBlockForCustomer

The company address for customers expressed as an address block of Addr1 through Addr5.
IAddressBlock   6.0  

Addr1

The first line of an address.
IQBStringType 41 chars    

Addr2

The second line of an address (if a second line is needed).
IQBStringType 41 chars    

Addr3

The third line of an address (if a third line is needed).
IQBStringType 41 chars    

Addr4

The fourth line of an address (if a fourth line is needed).
IQBStringType 41 chars    

Addr5

The fifth line of an address (if a fifth line is needed).
IQBStringType 41 chars    

Phone

The telephone number.
IQBStringType 51 chars    

Fax

Fax number.
IQBStringType 51 chars    

Email

E-mail address.
IQBStringType 1023 chars    

CompanyWebSite

The company’s public Web address.
IQBStringType 128 chars    

FirstMonthFiscalYear

The first month in the 12-month period over which a company tracks its finances. The QuickBooks user sets this value. In QuickBooks, FirstMonthFiscalYear determines the default date range for some reports and graphs.
IQBENFirstMonthFiscalYearType      

FirstMonthIncomeTaxYear

In QuickBooks, FirstMonthIncomeTaxYear determines the default date range for income tax summary and detail reports. The QuickBooks user sets this value.
IQBENFirstMonthIncomeTaxYearType      

CompanyType

The QuickBooks user selects a company type from a list when creating a company file.
IQBStringType 255 chars    

EIN

Employer Identification Number.
IQBStringType 20 chars 2.0  

SSN

Social security number.
IQBStringType 11 chars 2.1  

TaxForm

The tax form that the QuickBooks user expects to file for this company’s taxes. If a TaxForm value is assigned (that is, if it is not OtherOrNone), the QuickBooks user can associate each account with a tax form line. (An account’s tax form line information will show up in the response from an account query.)
IQBENTaxFormType   2.1  

SubscribedServices

Information returned from a company query about the Intuit services that the company is currently subscribed to, for example, Intuit Payroll, QBMS, and so forth
ISubscribedServices   7.0  

ServiceList

The list of the Intuit services that the company is or has been subscribed to, for example, Intuit Payroll, QBMS.
IServiceList      

(List

of IService Objects)
       

Name

The case-insensitive name of a list object, not including the names of its ancestors. Name must be unique, unless it is the Name of a “hierarchical” list object. List objects in different hierarchies can have duplicate names because their FullNames will still be unique. For example, two objects could both have the Name kitchen, but they could have unique FullNames, such as Job12:kitchen and Baker:kitchen. For built-in currencies, Name is the internationally accepted currency name and is not editable.
IQBStringType 50 chars   Y

Domain

Indicates the provider of the subscribed service, for example, Intuit.
IQBStringType 50 chars   Y

ServiceStatus

The status of the Intuit services that the company is or has been subscribed to, for example, Intuit Payroll, QBMS.
IQBENServiceStatusType     Y

AccountantCopy

Aggregate containing information about accountant copy. An Accountant’s Copy is a version of your company file your accountant can use to make changes while the original company file continues to be used for most normal operations. The key part of the accountant copy “protocol” is the dividing date which defines the fiscal period within which the accountant will be working. Dividing date is key because there are enforced restrictions against certain types of operations on data that fall within the fiscal period the accountant is working on.continue to work. The restrictions are listed below: Transactions: You can work only on transactions dated after the dividing date. Accounts: You can add a new account, but you cannot add a new subaccount to an existing account. Existing accounts: You cannot edit, merge, or make an existing account inactive. New accounts: You can edit an account or make any account inactive that you created while your accountant has the Accountant’s Copy. Lists (other than Chart of Accounts): You can edit, sort, and make list items inactive. You cannot delete or merge list items. Reconciling:You can reconcile your accounts while your accountant has an Accountant’s Copy. All reconciliations that include transactions in the current period (after the dividing date) are saved and will not be undone.To prevent conflicts with your accountant’s changes, reconciliations that include transactions dated on or before the dividing date will be undone when you import your accountant’s changes. If your accountant has reconciled or undone a reconciliation for any period, any reconciliations you did will be undone when you import your accountant’s changes.
IAccountantCopy   8.0  

AccountantCopyExists

Indicates whether an accountant copy has been made for this company file, with a value of true meaning a copy has been made and a value of false meaning there is no accountant copy.
IQBBoolType     Y

DividingDate

The dividing date indicates the fiscal period within which the accountant is working. This date is key because as long as the accountant copy exists, no transactions can be modified or created within that period. You can add new accounts, but you cannot add new subaccounts to existing accounts, and you cannot edit, merge, or make an existing account inactive. Finally, you cannot delete or merge list items.
IQBDateType      

DataExtRetList

A list of IDataExtRet objects, each of which represents a field that has been added to QuickBooks as a data extension.
IDataExtRetList   2.0  

(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      

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 31 chars   Y

DataExtType

The field’s data type, which corresponds to a qbXML data type. In an IDataExtDefAdd request object, if this is a custom field, DataExtType must be detSTR255TYPE.
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
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="16.0"?>
<QBXML>
        <QBXMLMsgsRq onError="stopOnError">
                <CompanyQueryRq>
                        <IncludeRetElement >STRTYPE</IncludeRetElement> <!-- optional, may repeat -->
                        <OwnerID >GUIDTYPE</OwnerID> <!-- optional, may repeat -->
                </CompanyQueryRq>

                <CompanyQueryRs statusCode="INTTYPE" statusSeverity="STRTYPE" statusMessage="STRTYPE">
                        <CompanyRet> <!-- optional -->
                                <IsSampleCompany >BOOLTYPE</IsSampleCompany> <!-- required -->
                                <CompanyName >STRTYPE</CompanyName> <!-- optional -->
                                <LegalCompanyName >STRTYPE</LegalCompanyName> <!-- optional -->
                                <Address> <!-- optional -->
                                        <Addr1 >STRTYPE</Addr1> <!-- optional -->
                                        <Addr2 >STRTYPE</Addr2> <!-- optional -->
                                        <Addr3 >STRTYPE</Addr3> <!-- optional -->
                                        <Addr4 >STRTYPE</Addr4> <!-- optional -->
                                        <Addr5 >STRTYPE</Addr5> <!-- optional -->
                                        <City >STRTYPE</City> <!-- optional -->
                                        <State >STRTYPE</State> <!-- optional -->
                                        <PostalCode >STRTYPE</PostalCode> <!-- optional -->
                                        <Country >STRTYPE</Country> <!-- optional -->
                                        <Note >STRTYPE</Note> <!-- optional -->
                                </Address>
                                <AddressBlock> <!-- optional -->
                                        <Addr1 >STRTYPE</Addr1> <!-- optional -->
                                        <Addr2 >STRTYPE</Addr2> <!-- optional -->
                                        <Addr3 >STRTYPE</Addr3> <!-- optional -->
                                        <Addr4 >STRTYPE</Addr4> <!-- optional -->
                                        <Addr5 >STRTYPE</Addr5> <!-- optional -->
                                </AddressBlock>
                                <LegalAddress> <!-- optional -->
                                        <Addr1 >STRTYPE</Addr1> <!-- optional -->
                                        <Addr2 >STRTYPE</Addr2> <!-- optional -->
                                        <Addr3 >STRTYPE</Addr3> <!-- optional -->
                                        <Addr4 >STRTYPE</Addr4> <!-- optional -->
                                        <Addr5 >STRTYPE</Addr5> <!-- optional -->
                                        <City >STRTYPE</City> <!-- optional -->
                                        <State >STRTYPE</State> <!-- optional -->
                                        <PostalCode >STRTYPE</PostalCode> <!-- optional -->
                                        <Country >STRTYPE</Country> <!-- optional -->
                                        <Note >STRTYPE</Note> <!-- optional -->
                                </LegalAddress>
                                <CompanyAddressForCustomer> <!-- optional -->
                                        <Addr1 >STRTYPE</Addr1> <!-- optional -->
                                        <Addr2 >STRTYPE</Addr2> <!-- optional -->
                                        <Addr3 >STRTYPE</Addr3> <!-- optional -->
                                        <Addr4 >STRTYPE</Addr4> <!-- optional -->
                                        <Addr5 >STRTYPE</Addr5> <!-- optional -->
                                        <City >STRTYPE</City> <!-- optional -->
                                        <State >STRTYPE</State> <!-- optional -->
                                        <PostalCode >STRTYPE</PostalCode> <!-- optional -->
                                        <Country >STRTYPE</Country> <!-- optional -->
                                        <Note >STRTYPE</Note> <!-- optional -->
                                </CompanyAddressForCustomer>
                                <CompanyAddressBlockForCustomer> <!-- optional -->
                                        <Addr1 >STRTYPE</Addr1> <!-- optional -->
                                        <Addr2 >STRTYPE</Addr2> <!-- optional -->
                                        <Addr3 >STRTYPE</Addr3> <!-- optional -->
                                        <Addr4 >STRTYPE</Addr4> <!-- optional -->
                                        <Addr5 >STRTYPE</Addr5> <!-- optional -->
                                </CompanyAddressBlockForCustomer>
                                <Phone >STRTYPE</Phone> <!-- optional -->
                                <Fax >STRTYPE</Fax> <!-- optional -->
                                <Email >STRTYPE</Email> <!-- optional -->
                                <CompanyWebSite >STRTYPE</CompanyWebSite> <!-- optional -->
                                <!-- FirstMonthFiscalYear may have one of the following values: January, February, March, April, May, June, July, August, September, October, November, December -->
                                <FirstMonthFiscalYear >ENUMTYPE</FirstMonthFiscalYear> <!-- optional -->
                                <!-- FirstMonthIncomeTaxYear may have one of the following values: January, February, March, April, May, June, July, August, September, October, November, December -->
                                <FirstMonthIncomeTaxYear >ENUMTYPE</FirstMonthIncomeTaxYear> <!-- optional -->
                                <CompanyType >STRTYPE</CompanyType> <!-- optional -->
                                <EIN >STRTYPE</EIN> <!-- optional -->
                                <SSN >STRTYPE</SSN> <!-- optional -->
                                <!-- TaxForm may have one of the following values: Form1040, Form1065, Form1120, Form1120S, Form990, Form990PF, Form990T, OtherOrNone -->
                                <TaxForm >ENUMTYPE</TaxForm> <!-- optional -->
                                <SubscribedServices> <!-- optional -->
                                        <Service> <!-- optional, may repeat -->
                                                <Name >STRTYPE</Name> <!-- required -->
                                                <Domain >STRTYPE</Domain> <!-- required -->
                                                <!-- ServiceStatus may have one of the following values: Active, Expired, Never, Pending, Suspended, Terminated, Trial -->
                                                <ServiceStatus >ENUMTYPE</ServiceStatus> <!-- required -->
                                        </Service>
                                </SubscribedServices>
                                <AccountantCopy> <!-- optional -->
                                        <AccountantCopyExists >BOOLTYPE</AccountantCopyExists> <!-- required -->
                                        <DividingDate >DATETYPE</DividingDate> <!-- optional -->
                                </AccountantCopy>
                                <DataExtRet> <!-- optional, may repeat -->
                                        <OwnerID >GUIDTYPE</OwnerID> <!-- optional -->
                                        <DataExtName >STRTYPE</DataExtName> <!-- required -->
                                        <!-- DataExtType may have one of the following values: AMTTYPE, DATETIMETYPE, INTTYPE, PERCENTTYPE, PRICETYPE, QUANTYPE, STR1024TYPE, STR255TYPE -->
                                        <DataExtType >ENUMTYPE</DataExtType> <!-- required -->
                                        <DataExtValue >STRTYPE</DataExtValue> <!-- required -->
                                </DataExtRet>
                        </CompanyRet>
                </CompanyQueryRs>
        </QBXMLMsgsRq>
</QBXML>

  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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
'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  DoCompanyQuery()
                        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
                                requestMsgSet = sessionManager.CreateMsgSetRequest("US",16,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("", ENOpenMode.omDontCare)
                                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 IncludeRetElementList
                        'May create more than one of these if needed
                        CompanyQueryRq.IncludeRetElementList.Add("ab")
                        '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 IsSampleCompany3783 as Boolean
                        IsSampleCompany3783 = CompanyRet.IsSampleCompany.GetValue()
                        'Get value of CompanyName
                        if ( not CompanyRet.CompanyName is nothing) then
                                Dim CompanyName3784 as String
                                CompanyName3784 = CompanyRet.CompanyName.GetValue()
                        End If
                        'Get value of LegalCompanyName
                        if ( not CompanyRet.LegalCompanyName is nothing) then
                                Dim LegalCompanyName3785 as String
                                LegalCompanyName3785 = CompanyRet.LegalCompanyName.GetValue()
                        End If
                        if (not CompanyRet.Address. is nothing) then
                                'Get value of Addr1
                                if ( not CompanyRet.Address.Addr1 is nothing) then
                                        Dim Addr13786 as String
                                        Addr13786 = CompanyRet.Address.Addr1.GetValue()
                                End If
                                'Get value of Addr2
                                if ( not CompanyRet.Address.Addr2 is nothing) then
                                        Dim Addr23787 as String
                                        Addr23787 = CompanyRet.Address.Addr2.GetValue()
                                End If
                                'Get value of Addr3
                                if ( not CompanyRet.Address.Addr3 is nothing) then
                                        Dim Addr33788 as String
                                        Addr33788 = CompanyRet.Address.Addr3.GetValue()
                                End If
                                'Get value of Addr4
                                if ( not CompanyRet.Address.Addr4 is nothing) then
                                        Dim Addr43789 as String
                                        Addr43789 = CompanyRet.Address.Addr4.GetValue()
                                End If
                                'Get value of Addr5
                                if ( not CompanyRet.Address.Addr5 is nothing) then
                                        Dim Addr53790 as String
                                        Addr53790 = CompanyRet.Address.Addr5.GetValue()
                                End If
                                'Get value of City
                                if ( not CompanyRet.Address.City is nothing) then
                                        Dim City3791 as String
                                        City3791 = CompanyRet.Address.City.GetValue()
                                End If
                                'Get value of State
                                if ( not CompanyRet.Address.State is nothing) then
                                        Dim State3792 as String
                                        State3792 = CompanyRet.Address.State.GetValue()
                                End If
                                'Get value of PostalCode
                                if ( not CompanyRet.Address.PostalCode is nothing) then
                                        Dim PostalCode3793 as String
                                        PostalCode3793 = CompanyRet.Address.PostalCode.GetValue()
                                End If
                                'Get value of Country
                                if ( not CompanyRet.Address.Country is nothing) then
                                        Dim Country3794 as String
                                        Country3794 = CompanyRet.Address.Country.GetValue()
                                End If
                                'Get value of Note
                                if ( not CompanyRet.Address.Note is nothing) then
                                        Dim Note3795 as String
                                        Note3795 = CompanyRet.Address.Note.GetValue()
                                End If
                        End If
                        if (not CompanyRet.AddressBlock. is nothing) then
                                'Get value of Addr1
                                if ( not CompanyRet.AddressBlock.Addr1 is nothing) then
                                        Dim Addr13796 as String
                                        Addr13796 = CompanyRet.AddressBlock.Addr1.GetValue()
                                End If
                                'Get value of Addr2
                                if ( not CompanyRet.AddressBlock.Addr2 is nothing) then
                                        Dim Addr23797 as String
                                        Addr23797 = CompanyRet.AddressBlock.Addr2.GetValue()
                                End If
                                'Get value of Addr3
                                if ( not CompanyRet.AddressBlock.Addr3 is nothing) then
                                        Dim Addr33798 as String
                                        Addr33798 = CompanyRet.AddressBlock.Addr3.GetValue()
                                End If
                                'Get value of Addr4
                                if ( not CompanyRet.AddressBlock.Addr4 is nothing) then
                                        Dim Addr43799 as String
                                        Addr43799 = CompanyRet.AddressBlock.Addr4.GetValue()
                                End If
                                'Get value of Addr5
                                if ( not CompanyRet.AddressBlock.Addr5 is nothing) then
                                        Dim Addr53800 as String
                                        Addr53800 = CompanyRet.AddressBlock.Addr5.GetValue()
                                End If
                        End If
                        if (not CompanyRet.LegalAddress. is nothing) then
                                'Get value of Addr1
                                if ( not CompanyRet.LegalAddress.Addr1 is nothing) then
                                        Dim Addr13801 as String
                                        Addr13801 = CompanyRet.LegalAddress.Addr1.GetValue()
                                End If
                                'Get value of Addr2
                                if ( not CompanyRet.LegalAddress.Addr2 is nothing) then
                                        Dim Addr23802 as String
                                        Addr23802 = CompanyRet.LegalAddress.Addr2.GetValue()
                                End If
                                'Get value of Addr3
                                if ( not CompanyRet.LegalAddress.Addr3 is nothing) then
                                        Dim Addr33803 as String
                                        Addr33803 = CompanyRet.LegalAddress.Addr3.GetValue()
                                End If
                                'Get value of Addr4
                                if ( not CompanyRet.LegalAddress.Addr4 is nothing) then
                                        Dim Addr43804 as String
                                        Addr43804 = CompanyRet.LegalAddress.Addr4.GetValue()
                                End If
                                'Get value of Addr5
                                if ( not CompanyRet.LegalAddress.Addr5 is nothing) then
                                        Dim Addr53805 as String
                                        Addr53805 = CompanyRet.LegalAddress.Addr5.GetValue()
                                End If
                                'Get value of City
                                if ( not CompanyRet.LegalAddress.City is nothing) then
                                        Dim City3806 as String
                                        City3806 = CompanyRet.LegalAddress.City.GetValue()
                                End If
                                'Get value of State
                                if ( not CompanyRet.LegalAddress.State is nothing) then
                                        Dim State3807 as String
                                        State3807 = CompanyRet.LegalAddress.State.GetValue()
                                End If
                                'Get value of PostalCode
                                if ( not CompanyRet.LegalAddress.PostalCode is nothing) then
                                        Dim PostalCode3808 as String
                                        PostalCode3808 = CompanyRet.LegalAddress.PostalCode.GetValue()
                                End If
                                'Get value of Country
                                if ( not CompanyRet.LegalAddress.Country is nothing) then
                                        Dim Country3809 as String
                                        Country3809 = CompanyRet.LegalAddress.Country.GetValue()
                                End If
                                'Get value of Note
                                if ( not CompanyRet.LegalAddress.Note is nothing) then
                                        Dim Note3810 as String
                                        Note3810 = CompanyRet.LegalAddress.Note.GetValue()
                                End If
                        End If
                        if (not CompanyRet.CompanyAddressForCustomer. is nothing) then
                                'Get value of Addr1
                                if ( not CompanyRet.CompanyAddressForCustomer.Addr1 is nothing) then
                                        Dim Addr13811 as String
                                        Addr13811 = CompanyRet.CompanyAddressForCustomer.Addr1.GetValue()
                                End If
                                'Get value of Addr2
                                if ( not CompanyRet.CompanyAddressForCustomer.Addr2 is nothing) then
                                        Dim Addr23812 as String
                                        Addr23812 = CompanyRet.CompanyAddressForCustomer.Addr2.GetValue()
                                End If
                                'Get value of Addr3
                                if ( not CompanyRet.CompanyAddressForCustomer.Addr3 is nothing) then
                                        Dim Addr33813 as String
                                        Addr33813 = CompanyRet.CompanyAddressForCustomer.Addr3.GetValue()
                                End If
                                'Get value of Addr4
                                if ( not CompanyRet.CompanyAddressForCustomer.Addr4 is nothing) then
                                        Dim Addr43814 as String
                                        Addr43814 = CompanyRet.CompanyAddressForCustomer.Addr4.GetValue()
                                End If
                                'Get value of Addr5
                                if ( not CompanyRet.CompanyAddressForCustomer.Addr5 is nothing) then
                                        Dim Addr53815 as String
                                        Addr53815 = CompanyRet.CompanyAddressForCustomer.Addr5.GetValue()
                                End If
                                'Get value of City
                                if ( not CompanyRet.CompanyAddressForCustomer.City is nothing) then
                                        Dim City3816 as String
                                        City3816 = CompanyRet.CompanyAddressForCustomer.City.GetValue()
                                End If
                                'Get value of State
                                if ( not CompanyRet.CompanyAddressForCustomer.State is nothing) then
                                        Dim State3817 as String
                                        State3817 = CompanyRet.CompanyAddressForCustomer.State.GetValue()
                                End If
                                'Get value of PostalCode
                                if ( not CompanyRet.CompanyAddressForCustomer.PostalCode is nothing) then
                                        Dim PostalCode3818 as String
                                        PostalCode3818 = CompanyRet.CompanyAddressForCustomer.PostalCode.GetValue()
                                End If
                                'Get value of Country
                                if ( not CompanyRet.CompanyAddressForCustomer.Country is nothing) then
                                        Dim Country3819 as String
                                        Country3819 = CompanyRet.CompanyAddressForCustomer.Country.GetValue()
                                End If
                                'Get value of Note
                                if ( not CompanyRet.CompanyAddressForCustomer.Note is nothing) then
                                        Dim Note3820 as String
                                        Note3820 = CompanyRet.CompanyAddressForCustomer.Note.GetValue()
                                End If
                        End If
                        if (not CompanyRet.CompanyAddressBlockForCustomer. is nothing) then
                                'Get value of Addr1
                                if ( not CompanyRet.CompanyAddressBlockForCustomer.Addr1 is nothing) then
                                        Dim Addr13821 as String
                                        Addr13821 = CompanyRet.CompanyAddressBlockForCustomer.Addr1.GetValue()
                                End If
                                'Get value of Addr2
                                if ( not CompanyRet.CompanyAddressBlockForCustomer.Addr2 is nothing) then
                                        Dim Addr23822 as String
                                        Addr23822 = CompanyRet.CompanyAddressBlockForCustomer.Addr2.GetValue()
                                End If
                                'Get value of Addr3
                                if ( not CompanyRet.CompanyAddressBlockForCustomer.Addr3 is nothing) then
                                        Dim Addr33823 as String
                                        Addr33823 = CompanyRet.CompanyAddressBlockForCustomer.Addr3.GetValue()
                                End If
                                'Get value of Addr4
                                if ( not CompanyRet.CompanyAddressBlockForCustomer.Addr4 is nothing) then
                                        Dim Addr43824 as String
                                        Addr43824 = CompanyRet.CompanyAddressBlockForCustomer.Addr4.GetValue()
                                End If
                                'Get value of Addr5
                                if ( not CompanyRet.CompanyAddressBlockForCustomer.Addr5 is nothing) then
                                        Dim Addr53825 as String
                                        Addr53825 = CompanyRet.CompanyAddressBlockForCustomer.Addr5.GetValue()
                                End If
                        End If
                        'Get value of Phone
                        if ( not CompanyRet.Phone is nothing) then
                                Dim Phone3826 as String
                                Phone3826 = CompanyRet.Phone.GetValue()
                        End If
                        'Get value of Fax
                        if ( not CompanyRet.Fax is nothing) then
                                Dim Fax3827 as String
                                Fax3827 = CompanyRet.Fax.GetValue()
                        End If
                        'Get value of Email
                        if ( not CompanyRet.Email is nothing) then
                                Dim Email3828 as String
                                Email3828 = CompanyRet.Email.GetValue()
                        End If
                        'Get value of CompanyWebSite
                        if ( not CompanyRet.CompanyWebSite is nothing) then
                                Dim CompanyWebSite3829 as String
                                CompanyWebSite3829 = CompanyRet.CompanyWebSite.GetValue()
                        End If
                        'Get value of FirstMonthFiscalYear
                        if ( not CompanyRet.FirstMonthFiscalYear is nothing) then
                                Dim FirstMonthFiscalYear3830 as ENFirstMonthFiscalYear
                                FirstMonthFiscalYear3830 = CompanyRet.FirstMonthFiscalYear.GetValue()
                        End If
                        'Get value of FirstMonthIncomeTaxYear
                        if ( not CompanyRet.FirstMonthIncomeTaxYear is nothing) then
                                Dim FirstMonthIncomeTaxYear3831 as ENFirstMonthIncomeTaxYear
                                FirstMonthIncomeTaxYear3831 = CompanyRet.FirstMonthIncomeTaxYear.GetValue()
                        End If
                        'Get value of CompanyType
                        if ( not CompanyRet.CompanyType is nothing) then
                                Dim CompanyType3832 as String
                                CompanyType3832 = CompanyRet.CompanyType.GetValue()
                        End If
                        'Get value of EIN
                        if ( not CompanyRet.EIN is nothing) then
                                Dim EIN3833 as String
                                EIN3833 = CompanyRet.EIN.GetValue()
                        End If
                        'Get value of SSN
                        if ( not CompanyRet.SSN is nothing) then
                                Dim SSN3834 as String
                                SSN3834 = CompanyRet.SSN.GetValue()
                        End If
                        'Get value of TaxForm
                        if ( not CompanyRet.TaxForm is nothing) then
                                Dim TaxForm3835 as ENTaxForm
                                TaxForm3835 = CompanyRet.TaxForm.GetValue()
                        End If
                        if (not CompanyRet.SubscribedServices. is nothing) then
                                if (not CompanyRet.SubscribedServices.ServiceList is nothing)
                                        Dim i3836 as Integer
                                        for i3836 = 0  to CompanyRet.SubscribedServices.ServiceList.Count - 1
                                                Dim Service as IService
                                                Service = CompanyRet.SubscribedServices.ServiceList.GetAt(i3836)
                                                'Get value of Name
                                                Dim Name3837 as String
                                                Name3837 = ServiceName.GetValue()
                                                'Get value of Domain
                                                Dim Domain3838 as String
                                                Domain3838 = ServiceDomain.GetValue()
                                                'Get value of ServiceStatus
                                                Dim ServiceStatus3839 as ENServiceStatus
                                                ServiceStatus3839 = ServiceServiceStatus.GetValue()
                                        Next i3836
                                End If
                        End If
                        if (not CompanyRet.AccountantCopy. is nothing) then
                                'Get value of AccountantCopyExists
                                Dim AccountantCopyExists3840 as Boolean
                                AccountantCopyExists3840 = CompanyRet.AccountantCopy.AccountantCopyExists.GetValue()
                                'Get value of DividingDate
                                if ( not CompanyRet.AccountantCopy.DividingDate is nothing) then
                                        Dim DividingDate3841 as DateTime
                                        DividingDate3841 = CompanyRet.AccountantCopy.DividingDate.GetValue()
                                End If
                        End If
                        if (not CompanyRet.DataExtRetList is nothing)
                                Dim i3842 as Integer
                                for i3842 = 0  to CompanyRet.DataExtRetList.Count - 1
                                        Dim DataExtRet as IDataExtRet
                                        DataExtRet = CompanyRet.DataExtRetList.GetAt(i3842)
                                        'Get value of OwnerID
                                        if ( not DataExtRetOwnerID is nothing) then
                                                Dim OwnerID3843 as String
                                                OwnerID3843 = DataExtRetOwnerID.GetValue()
                                        End If
                                        'Get value of DataExtName
                                        Dim DataExtName3844 as String
                                        DataExtName3844 = DataExtRetDataExtName.GetValue()
                                        'Get value of DataExtType
                                        Dim DataExtType3845 as ENDataExtType
                                        DataExtType3845 = DataExtRetDataExtType.GetValue()
                                        'Get value of DataExtValue
                                        Dim DataExtValue3846 as String
                                        DataExtValue3846 = DataExtRetDataExtValue.GetValue()
                                Next i3842
                        End If
                End Sub




        End Class
End Module

  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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
//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  DoCompanyQuery()
                {
                        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;

                                BuildCompanyQueryRq(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
                                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 IncludeRetElementList
                        //May create more than one of these if needed
                        CompanyQueryRq.IncludeRetElementList.Add("ab");
                        //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 IsSampleCompany3719 = (bool)CompanyRet.IsSampleCompany.GetValue();
                        //Get value of CompanyName
                        if (CompanyRet.CompanyName != null)
                        {
                                string CompanyName3720 = (string)CompanyRet.CompanyName.GetValue();
                        }
                        //Get value of LegalCompanyName
                        if (CompanyRet.LegalCompanyName != null)
                        {
                                string LegalCompanyName3721 = (string)CompanyRet.LegalCompanyName.GetValue();
                        }
                        if (CompanyRet.Address != null)
                        {
                                //Get value of Addr1
                                if (CompanyRet.Address.Addr1 != null)
                                {
                                        string Addr13722 = (string)CompanyRet.Address.Addr1.GetValue();
                                }
                                //Get value of Addr2
                                if (CompanyRet.Address.Addr2 != null)
                                {
                                        string Addr23723 = (string)CompanyRet.Address.Addr2.GetValue();
                                }
                                //Get value of Addr3
                                if (CompanyRet.Address.Addr3 != null)
                                {
                                        string Addr33724 = (string)CompanyRet.Address.Addr3.GetValue();
                                }
                                //Get value of Addr4
                                if (CompanyRet.Address.Addr4 != null)
                                {
                                        string Addr43725 = (string)CompanyRet.Address.Addr4.GetValue();
                                }
                                //Get value of Addr5
                                if (CompanyRet.Address.Addr5 != null)
                                {
                                        string Addr53726 = (string)CompanyRet.Address.Addr5.GetValue();
                                }
                                //Get value of City
                                if (CompanyRet.Address.City != null)
                                {
                                        string City3727 = (string)CompanyRet.Address.City.GetValue();
                                }
                                //Get value of State
                                if (CompanyRet.Address.State != null)
                                {
                                        string State3728 = (string)CompanyRet.Address.State.GetValue();
                                }
                                //Get value of PostalCode
                                if (CompanyRet.Address.PostalCode != null)
                                {
                                        string PostalCode3729 = (string)CompanyRet.Address.PostalCode.GetValue();
                                }
                                //Get value of Country
                                if (CompanyRet.Address.Country != null)
                                {
                                        string Country3730 = (string)CompanyRet.Address.Country.GetValue();
                                }
                                //Get value of Note
                                if (CompanyRet.Address.Note != null)
                                {
                                        string Note3731 = (string)CompanyRet.Address.Note.GetValue();
                                }
                        }
                        if (CompanyRet.AddressBlock != null)
                        {
                                //Get value of Addr1
                                if (CompanyRet.AddressBlock.Addr1 != null)
                                {
                                        string Addr13732 = (string)CompanyRet.AddressBlock.Addr1.GetValue();
                                }
                                //Get value of Addr2
                                if (CompanyRet.AddressBlock.Addr2 != null)
                                {
                                        string Addr23733 = (string)CompanyRet.AddressBlock.Addr2.GetValue();
                                }
                                //Get value of Addr3
                                if (CompanyRet.AddressBlock.Addr3 != null)
                                {
                                        string Addr33734 = (string)CompanyRet.AddressBlock.Addr3.GetValue();
                                }
                                //Get value of Addr4
                                if (CompanyRet.AddressBlock.Addr4 != null)
                                {
                                        string Addr43735 = (string)CompanyRet.AddressBlock.Addr4.GetValue();
                                }
                                //Get value of Addr5
                                if (CompanyRet.AddressBlock.Addr5 != null)
                                {
                                        string Addr53736 = (string)CompanyRet.AddressBlock.Addr5.GetValue();
                                }
                        }
                        if (CompanyRet.LegalAddress != null)
                        {
                                //Get value of Addr1
                                if (CompanyRet.LegalAddress.Addr1 != null)
                                {
                                        string Addr13737 = (string)CompanyRet.LegalAddress.Addr1.GetValue();
                                }
                                //Get value of Addr2
                                if (CompanyRet.LegalAddress.Addr2 != null)
                                {
                                        string Addr23738 = (string)CompanyRet.LegalAddress.Addr2.GetValue();
                                }
                                //Get value of Addr3
                                if (CompanyRet.LegalAddress.Addr3 != null)
                                {
                                        string Addr33739 = (string)CompanyRet.LegalAddress.Addr3.GetValue();
                                }
                                //Get value of Addr4
                                if (CompanyRet.LegalAddress.Addr4 != null)
                                {
                                        string Addr43740 = (string)CompanyRet.LegalAddress.Addr4.GetValue();
                                }
                                //Get value of Addr5
                                if (CompanyRet.LegalAddress.Addr5 != null)
                                {
                                        string Addr53741 = (string)CompanyRet.LegalAddress.Addr5.GetValue();
                                }
                                //Get value of City
                                if (CompanyRet.LegalAddress.City != null)
                                {
                                        string City3742 = (string)CompanyRet.LegalAddress.City.GetValue();
                                }
                                //Get value of State
                                if (CompanyRet.LegalAddress.State != null)
                                {
                                        string State3743 = (string)CompanyRet.LegalAddress.State.GetValue();
                                }
                                //Get value of PostalCode
                                if (CompanyRet.LegalAddress.PostalCode != null)
                                {
                                        string PostalCode3744 = (string)CompanyRet.LegalAddress.PostalCode.GetValue();
                                }
                                //Get value of Country
                                if (CompanyRet.LegalAddress.Country != null)
                                {
                                        string Country3745 = (string)CompanyRet.LegalAddress.Country.GetValue();
                                }
                                //Get value of Note
                                if (CompanyRet.LegalAddress.Note != null)
                                {
                                        string Note3746 = (string)CompanyRet.LegalAddress.Note.GetValue();
                                }
                        }
                        if (CompanyRet.CompanyAddressForCustomer != null)
                        {
                                //Get value of Addr1
                                if (CompanyRet.CompanyAddressForCustomer.Addr1 != null)
                                {
                                        string Addr13747 = (string)CompanyRet.CompanyAddressForCustomer.Addr1.GetValue();
                                }
                                //Get value of Addr2
                                if (CompanyRet.CompanyAddressForCustomer.Addr2 != null)
                                {
                                        string Addr23748 = (string)CompanyRet.CompanyAddressForCustomer.Addr2.GetValue();
                                }
                                //Get value of Addr3
                                if (CompanyRet.CompanyAddressForCustomer.Addr3 != null)
                                {
                                        string Addr33749 = (string)CompanyRet.CompanyAddressForCustomer.Addr3.GetValue();
                                }
                                //Get value of Addr4
                                if (CompanyRet.CompanyAddressForCustomer.Addr4 != null)
                                {
                                        string Addr43750 = (string)CompanyRet.CompanyAddressForCustomer.Addr4.GetValue();
                                }
                                //Get value of Addr5
                                if (CompanyRet.CompanyAddressForCustomer.Addr5 != null)
                                {
                                        string Addr53751 = (string)CompanyRet.CompanyAddressForCustomer.Addr5.GetValue();
                                }
                                //Get value of City
                                if (CompanyRet.CompanyAddressForCustomer.City != null)
                                {
                                        string City3752 = (string)CompanyRet.CompanyAddressForCustomer.City.GetValue();
                                }
                                //Get value of State
                                if (CompanyRet.CompanyAddressForCustomer.State != null)
                                {
                                        string State3753 = (string)CompanyRet.CompanyAddressForCustomer.State.GetValue();
                                }
                                //Get value of PostalCode
                                if (CompanyRet.CompanyAddressForCustomer.PostalCode != null)
                                {
                                        string PostalCode3754 = (string)CompanyRet.CompanyAddressForCustomer.PostalCode.GetValue();
                                }
                                //Get value of Country
                                if (CompanyRet.CompanyAddressForCustomer.Country != null)
                                {
                                        string Country3755 = (string)CompanyRet.CompanyAddressForCustomer.Country.GetValue();
                                }
                                //Get value of Note
                                if (CompanyRet.CompanyAddressForCustomer.Note != null)
                                {
                                        string Note3756 = (string)CompanyRet.CompanyAddressForCustomer.Note.GetValue();
                                }
                        }
                        if (CompanyRet.CompanyAddressBlockForCustomer != null)
                        {
                                //Get value of Addr1
                                if (CompanyRet.CompanyAddressBlockForCustomer.Addr1 != null)
                                {
                                        string Addr13757 = (string)CompanyRet.CompanyAddressBlockForCustomer.Addr1.GetValue();
                                }
                                //Get value of Addr2
                                if (CompanyRet.CompanyAddressBlockForCustomer.Addr2 != null)
                                {
                                        string Addr23758 = (string)CompanyRet.CompanyAddressBlockForCustomer.Addr2.GetValue();
                                }
                                //Get value of Addr3
                                if (CompanyRet.CompanyAddressBlockForCustomer.Addr3 != null)
                                {
                                        string Addr33759 = (string)CompanyRet.CompanyAddressBlockForCustomer.Addr3.GetValue();
                                }
                                //Get value of Addr4
                                if (CompanyRet.CompanyAddressBlockForCustomer.Addr4 != null)
                                {
                                        string Addr43760 = (string)CompanyRet.CompanyAddressBlockForCustomer.Addr4.GetValue();
                                }
                                //Get value of Addr5
                                if (CompanyRet.CompanyAddressBlockForCustomer.Addr5 != null)
                                {
                                        string Addr53761 = (string)CompanyRet.CompanyAddressBlockForCustomer.Addr5.GetValue();
                                }
                        }
                        //Get value of Phone
                        if (CompanyRet.Phone != null)
                        {
                                string Phone3762 = (string)CompanyRet.Phone.GetValue();
                        }
                        //Get value of Fax
                        if (CompanyRet.Fax != null)
                        {
                                string Fax3763 = (string)CompanyRet.Fax.GetValue();
                        }
                        //Get value of Email
                        if (CompanyRet.Email != null)
                        {
                                string Email3764 = (string)CompanyRet.Email.GetValue();
                        }
                        //Get value of CompanyWebSite
                        if (CompanyRet.CompanyWebSite != null)
                        {
                                string CompanyWebSite3765 = (string)CompanyRet.CompanyWebSite.GetValue();
                        }
                        //Get value of FirstMonthFiscalYear
                        if (CompanyRet.FirstMonthFiscalYear != null)
                        {
                                ENFirstMonthFiscalYear FirstMonthFiscalYear3766 = (ENFirstMonthFiscalYear)CompanyRet.FirstMonthFiscalYear.GetValue();
                        }
                        //Get value of FirstMonthIncomeTaxYear
                        if (CompanyRet.FirstMonthIncomeTaxYear != null)
                        {
                                ENFirstMonthIncomeTaxYear FirstMonthIncomeTaxYear3767 = (ENFirstMonthIncomeTaxYear)CompanyRet.FirstMonthIncomeTaxYear.GetValue();
                        }
                        //Get value of CompanyType
                        if (CompanyRet.CompanyType != null)
                        {
                                string CompanyType3768 = (string)CompanyRet.CompanyType.GetValue();
                        }
                        //Get value of EIN
                        if (CompanyRet.EIN != null)
                        {
                                string EIN3769 = (string)CompanyRet.EIN.GetValue();
                        }
                        //Get value of SSN
                        if (CompanyRet.SSN != null)
                        {
                                string SSN3770 = (string)CompanyRet.SSN.GetValue();
                        }
                        //Get value of TaxForm
                        if (CompanyRet.TaxForm != null)
                        {
                                ENTaxForm TaxForm3771 = (ENTaxForm)CompanyRet.TaxForm.GetValue();
                        }
                        if (CompanyRet.SubscribedServices != null)
                        {
                                if (CompanyRet.SubscribedServices.ServiceList != null)
                                {
                                        for (int i3772 = 0; i3772 < CompanyRet.SubscribedServices.ServiceList.Count; i3772++)
                                        {
                                                IService Service = CompanyRet.SubscribedServices.ServiceList.GetAt(i3772);
                                                //Get value of Name
                                                string Name3773 = (string)Service.Name.GetValue();
                                                //Get value of Domain
                                                string Domain3774 = (string)Service.Domain.GetValue();
                                                //Get value of ServiceStatus
                                                ENServiceStatus ServiceStatus3775 = (ENServiceStatus)Service.ServiceStatus.GetValue();
                                        }
                                }
                        }
                        if (CompanyRet.AccountantCopy != null)
                        {
                                //Get value of AccountantCopyExists
                                bool AccountantCopyExists3776 = (bool)CompanyRet.AccountantCopy.AccountantCopyExists.GetValue();
                                //Get value of DividingDate
                                if (CompanyRet.AccountantCopy.DividingDate != null)
                                {
                                        DateTime DividingDate3777 = (DateTime)CompanyRet.AccountantCopy.DividingDate.GetValue();
                                }
                        }
                        if (CompanyRet.DataExtRetList != null)
                        {
                                for (int i3778 = 0; i3778 < CompanyRet.DataExtRetList.Count; i3778++)
                                {
                                        IDataExtRet DataExtRet = CompanyRet.DataExtRetList.GetAt(i3778);
                                        //Get value of OwnerID
                                        if (DataExtRet.OwnerID != null)
                                        {
                                                string OwnerID3779 = (string)DataExtRet.OwnerID.GetValue();
                                        }
                                        //Get value of DataExtName
                                        string DataExtName3780 = (string)DataExtRet.DataExtName.GetValue();
                                        //Get value of DataExtType
                                        ENDataExtType DataExtType3781 = (ENDataExtType)DataExtRet.DataExtType.GetValue();
                                        //Get value of DataExtValue
                                        string DataExtValue3782 = (string)DataExtRet.DataExtValue.GetValue();
                                }
                        }
                }




        }
}