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:
Request
Response
XMLOps
VB.NET
C#
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(); } } } } } |