VendorAdd

Adds a new vendor to the QBPOS company. Each vendor from whom you purchase merchandise is identified within QBPOS by a unique, user-defined code of one to three alphanumeric characters when you create a vendor in QBPOS. Later, you assign a vendor code to each item defined in inventory. QBPOS uses the vendor code to track and report on the merchandise by vendor as it is ordered, received, and sold.


Request

Response

XMLOPS

VB.NET

C#

Tag Type Max length Implementation Required

IVendorAdd

Adds a new vendor to the QBPOS company. Each vendor from whom you purchase merchandise is identified within QBPOS by a unique, user-defined code of one to three alphanumeric characters when you create a vendor in QBPOS. Later, you assign a vendor code to each item defined in inventory. QBPOS uses the vendor code to track and report on the merchandise by vendor as it is ordered, received, and sold.
       

defMacro

You use a macro in a request message set if you need to create some object in one request, then refer to it in a subsequent request within that same message set. For example, you could create an inventory item and then include that item as a line item in a sales order all in one request message set, rather than create the item, query for it, then include it in a separate SalesOrderAdd request. In this latter case, you are accessing QBPOS three times, versus only once, using macros. The item to be referenced is specified via the defmacro. The actual reference to that item in the succeeding request is done via the use macro, as follows: ItemInventoryAdd defMacro=”ListID:Inv1” In the above line, you simply replace Inv1 with the name you want to give the macro. When you reference this macro in another request (one that requires that object’s listID) in the same message set, you use this syntax: ListID useMacro=”ListID:Inv1” This is covered in more detail in the Programming Guide.
IQBStringType   2.0  

AccountNumber

Your account number with the vendor. This number is displayed on purchase orders that are created for the vendor.
IQBStringType 99 chars    

City

The city name in the address.
IQBStringType 31 chars    

CompanyName

The name of the business.
IQBStringType 41 chars    

Country

The country of residence of this employee.
IQBStringType 31 chars 1.1  

EMail

The email address.
IQBStringType 99 chars    

FirstName

The first name.
IQBStringType 30 chars    

IsInactive

Indicates whether the item is currently active.
IQBBoolType      

LastName

The last name.
IQBStringType 30 chars    

Notes

Any optional information about the vendor, such as lead time, FOB location, and so on.
IQBStringType 245 chars    

Phone

Primary Telephone number of this person or entity.
IQBStringType 40 chars    

Phone2

Alternate phone number or fax number for this person or entity. This maps to Phone 2 in the QBPOS UI.
IQBStringType 40 chars    

Phone3

Alternate phone number or fax number for this person or entity. This maps to Alt. Phone in the QBPOS UI.
IQBStringType 40 chars 1.1  

Phone4

Alternate phone number, fax number, or other contact information for this person or entity. This maps to Alt. Contact in the QBPOS UI.
IQBStringType 40 chars 1.1  

PostalCode

The postal code used in the address.
IQBStringType 13 chars    

Salutation

A formal reference, such as Mr. or Dr., that precedes a name.
IQBStringType 15 chars    

State

The state name in the address.
IQBStringType 21 chars    

Street

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

Street2

Street Address of the vendor, customer, or other addressee.
IQBStringType 41 chars 3.0  

TermsDiscount

The TermsDiscount field specifies the discount percentage. A discount is applied by the vendor if payment is received on or before the number of days specified in the TermsDiscountDays field for that vendor. Terms-related discounts for vendors are created or modified in the VendorAdd/VendorMod fields TermsDiscountDays and TermsDiscount.
IQBFloatType      

TermsDiscountDays

The TermsDiscountDays field specifies the number of days after the invoice date in which payment must be received in order to obtain the discount percentage. A discount is applied by the vendor if payment is received on or before the number of days specified in the TermsDiscountDays field for that vendor. Terms-related discounts for vendors are created or modified in the VendorAdd/VendorMod fields TermsDiscountDays and TermsDiscount.
IQBIntType      

TermsNetDays

This establishes the vendor’s payment due date, which is based on the vendor’s invoice date. The due date is established by the number of days specified in this field after the invoice date. Payment must be made within this number of days.
IQBIntType      

VendorCode

The code assigned to the vendor specified for the item.
IQBStringType 3 chars   Y

IncludeRetElementList

You can use the IncludeRetElement feature to restrict the data returned in the response to the specified qbposXML field here. If you do this, only those elements specified will be returned. To use this feature, you simply add the qbposXML element name to the IncludeRetElementList. The following example shows how to do this, specifying that only the CreatedBy and ClockOutTime elements are to be returned in the TimeEntryAdd response: Dim MyTimeEntry As ITimeEntryAdd Set MyTimeEntry = requestMsgSet.AppendTimeEntryAddRq MyTimeEntry.IncludeRetElementList.Add “CreatedBy” MyTimeEntry.IncludeRetElementList.Add “ClockOutTime” ‘ set the other properties as desired…
IBSTRList 50 chars 2.0  
Tag Type Max length Implementation Required

IResponse

Adds a new vendor to the QBPOS company. Each vendor from whom you purchase merchandise is identified within QBPOS by a unique, user-defined code of one to three alphanumeric characters when you create a vendor in QBPOS. Later, you assign a vendor code to each item defined in inventory. QBPOS uses the vendor code to track and report on the merchandise by vendor as it is ordered, received, and sold.
       

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

IVendorRet      

ListID

The unique ID returned by QBPOS for this object. If supplied in a request, the ListID is a reference to an object required in the request. For example, in a SalesOrder or PurchaseOrder line item, the ListID that is required is an Item list ID.
IQBIDType      

TimeCreated

The timestamp indicating the time when this object was created in QBPOS.
IQBDateTimeType   1.1  

TimeModified

The time when the object was modified by QBPOS.
IQBDateTimeType      

AccountNumber

Your account number with the vendor. This number is displayed on purchase orders that are created for the vendor.
IQBStringType 99 chars    

City

The city name in the address.
IQBStringType 31 chars    

CompanyName

The name of the business.
IQBStringType 41 chars    

Country

The country of residence of this employee.
IQBStringType 31 chars 1.1  

EMail

The email address.
IQBStringType 99 chars    

FirstName

The first name.
IQBStringType 30 chars    

IsInactive

Indicates whether the item is currently active.
IQBBoolType      

LastName

The last name.
IQBStringType 30 chars    

Notes

Any optional information about the vendor, such as lead time, FOB location, and so on.
IQBStringType 245 chars    

Phone

Primary Telephone number of this person or entity.
IQBStringType 40 chars    

Phone2

Alternate phone number or fax number for this person or entity. This maps to Phone 2 in the QBPOS UI.
IQBStringType 40 chars    

Phone3

Alternate phone number or fax number for this person or entity. This maps to Alt. Phone in the QBPOS UI.
IQBStringType 40 chars 1.1  

Phone4

Alternate phone number, fax number, or other contact information for this person or entity. This maps to Alt. Contact in the QBPOS UI.
IQBStringType 40 chars 1.1  

PostalCode

The postal code used in the address.
IQBStringType 13 chars    

Salutation

A formal reference, such as Mr. or Dr., that precedes a name.
IQBStringType 15 chars    

State

The state name in the address.
IQBStringType 21 chars    

StoreExchangeStatus

In multi store configurations, if the customer’s information has changed, this information is updated at the headquarters store. This response field indicates whether the information was successfully updated or not.
IQBENStoreExchangeStatusType      

Street

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

Street2

Street Address of the vendor, customer, or other addressee.
IQBStringType 41 chars 3.0  

Terms

While not visible on the PO, any payment terms that are defined for the vendor file are carried to the PO and are available in this field in the returned PO object.
IQBStringType      

TermsDiscount

The TermsDiscount field specifies the discount percentage. A discount is applied by the vendor if payment is received on or before the number of days specified in the TermsDiscountDays field for that vendor. Terms-related discounts for vendors are created or modified in the VendorAdd/VendorMod fields TermsDiscountDays and TermsDiscount.
IQBFloatType      

TermsDiscountDays

The TermsDiscountDays field specifies the number of days after the invoice date in which payment must be received in order to obtain the discount percentage. A discount is applied by the vendor if payment is received on or before the number of days specified in the TermsDiscountDays field for that vendor. Terms-related discounts for vendors are created or modified in the VendorAdd/VendorMod fields TermsDiscountDays and TermsDiscount.
IQBIntType      

TermsNetDays

This establishes the vendor’s payment due date, which is based on the vendor’s invoice date. The due date is established by the number of days specified in this field after the invoice date. Payment must be made within this number of days.
IQBIntType      

VendorCode

The code assigned to the vendor specified for the item.
IQBStringType 3 chars    

DataExtRetList

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

(List of IDataExtRet Objects)

       

OwnerID

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

DataExtName

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

DataExtType

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

DataExtValue

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?xml version="1.0" encoding="utf-8"?>
<?qbposxml version="4.0"?>
<QBPOSXML>
        <QBPOSXMLMsgsRq onError="stopOnError">
                <VendorAddRq>
                        <VendorAdd defMacro="MACROTYPE"> <!-- required -->
                                <AccountNumber >STRTYPE</AccountNumber> <!-- optional -->
                                <City >STRTYPE</City> <!-- optional -->
                                <CompanyName >STRTYPE</CompanyName> <!-- optional -->
                                <Country >STRTYPE</Country> <!-- optional -->
                                <EMail >STRTYPE</EMail> <!-- optional -->
                                <FirstName >STRTYPE</FirstName> <!-- optional -->
                                <IsInactive >BOOLTYPE</IsInactive> <!-- optional -->
                                <LastName >STRTYPE</LastName> <!-- optional -->
                                <Notes >STRTYPE</Notes> <!-- optional -->
                                <Phone >STRTYPE</Phone> <!-- optional -->
                                <Phone2 >STRTYPE</Phone2> <!-- optional -->
                                <Phone3 >STRTYPE</Phone3> <!-- optional -->
                                <Phone4 >STRTYPE</Phone4> <!-- optional -->
                                <PostalCode >STRTYPE</PostalCode> <!-- optional -->
                                <Salutation >STRTYPE</Salutation> <!-- optional -->
                                <State >STRTYPE</State> <!-- optional -->
                                <Street >STRTYPE</Street> <!-- optional -->
                                <Street2 >STRTYPE</Street2> <!-- optional -->
                                <TermsDiscount >FLOATTYPE</TermsDiscount> <!-- optional -->
                                <TermsDiscountDays >INTTYPE</TermsDiscountDays> <!-- optional -->
                                <TermsNetDays >INTTYPE</TermsNetDays> <!-- optional -->
                                <VendorCode >STRTYPE</VendorCode> <!-- required -->
                        </VendorAdd>
                        <IncludeRetElement >STRTYPE</IncludeRetElement> <!-- optional, may repeat -->
                </VendorAddRq>

                <VendorAddRs statusCode="INTTYPE" statusSeverity="STRTYPE" statusMessage="STRTYPE">
                        <VendorRet> <!-- optional -->
                                <ListID >IDTYPE</ListID> <!-- optional -->
                                <TimeCreated >DATETIMETYPE</TimeCreated> <!-- optional -->
                                <TimeModified >DATETIMETYPE</TimeModified> <!-- optional -->
                                <AccountNumber >STRTYPE</AccountNumber> <!-- optional -->
                                <City >STRTYPE</City> <!-- optional -->
                                <CompanyName >STRTYPE</CompanyName> <!-- optional -->
                                <Country >STRTYPE</Country> <!-- optional -->
                                <EMail >STRTYPE</EMail> <!-- optional -->
                                <FirstName >STRTYPE</FirstName> <!-- optional -->
                                <IsInactive >BOOLTYPE</IsInactive> <!-- optional -->
                                <LastName >STRTYPE</LastName> <!-- optional -->
                                <Notes >STRTYPE</Notes> <!-- optional -->
                                <Phone >STRTYPE</Phone> <!-- optional -->
                                <Phone2 >STRTYPE</Phone2> <!-- optional -->
                                <Phone3 >STRTYPE</Phone3> <!-- optional -->
                                <Phone4 >STRTYPE</Phone4> <!-- optional -->
                                <PostalCode >STRTYPE</PostalCode> <!-- optional -->
                                <Salutation >STRTYPE</Salutation> <!-- optional -->
                                <State >STRTYPE</State> <!-- optional -->
                                <!-- StoreExchangeStatus may have one of the following values: Modified, Sent, Acknowledged -->
                                <StoreExchangeStatus >ENUMTYPE</StoreExchangeStatus> <!-- optional -->
                                <Street >STRTYPE</Street> <!-- optional -->
                                <Street2 >STRTYPE</Street2> <!-- optional -->
                                <Terms >STRTYPE</Terms> <!-- optional -->
                                <TermsDiscount >FLOATTYPE</TermsDiscount> <!-- optional -->
                                <TermsDiscountDays >INTTYPE</TermsDiscountDays> <!-- optional -->
                                <TermsNetDays >INTTYPE</TermsNetDays> <!-- optional -->
                                <VendorCode >STRTYPE</VendorCode> <!-- optional -->
                                <DataExtRet> <!-- optional, may repeat -->
                                        <OwnerID >GUIDTYPE</OwnerID> <!-- required -->
                                        <DataExtName >STRTYPE</DataExtName> <!-- required -->
                                        <!-- DataExtType may have one of the following values: INTTYPE, AMTTYPE, PRICETYPE, QUANTYPE, PERCENTTYPE, DATETIMETYPE, STR255TYPE, STR1024TYPE -->
                                        <DataExtType >ENUMTYPE</DataExtType> <!-- required -->
                                        <DataExtValue >STRTYPE</DataExtValue> <!-- required -->
                                </DataExtRet>
                        </VendorRet>
                </VendorAddRs>
        </QBPOSXMLMsgsRq>
</QBPOSXML>

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

imports System
imports System.Net
imports System.Drawing
imports System.Collections
imports System.ComponentModel
imports System.Windows.Forms
imports System.Data
imports System.IO
imports Interop.qbposfc4

        Public Class SampleVendorAdd
                Public Sub  DoVendorAdd()
                        Dim sessionBegun as Boolean
                        sessionBegun = False
                        Dim connectionOpen as Boolean
                        connectionOpen = False
                        Dim sessionManager as QBPOSSessionManager
                        sessionManager = nothing

                        Try
                                'Create the session Manager object
                                sessionManager = new QBPOSSessionManager

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

                                BuildVendorAddRq(requestMsgSet)

                                'Connect to QuickBooks and begin a session
                                sessionManager.OpenConnection("","Sample Code from OSR")
                                connectionOpen = True
                                sessionManager.BeginSession("")
                                sessionBegun = True

                                'Send the request and get the response from QuickBooks
                                Dim responseMsgSet as IMsgSetResponse
                                responseMsgSet = sessionManager.DoRequests(requestMsgSet)

                                'End the session and close the connection to QuickBooks
                                sessionManager.EndSession()
                                sessionBegun = False
                                sessionManager.CloseConnection()
                                connectionOpen = False

                                WalkVendorAddRs(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 BuildVendorAddRq(requestMsgSet as IMsgSetRequest)
                        Dim VendorAddRq as IVendorAdd
                        VendorAddRq= requestMsgSet.AppendVendorAddRq()
                        'Set field value for AccountNumber
                        VendorAddRq.AccountNumber.SetValue("ab")
                        'Set field value for City
                        VendorAddRq.City.SetValue("ab")
                        'Set field value for CompanyName
                        VendorAddRq.CompanyName.SetValue("ab")
                        'Set field value for Country
                        VendorAddRq.Country.SetValue("ab")
                        'Set field value for EMail
                        VendorAddRq.EMail.SetValue("ab")
                        'Set field value for FirstName
                        VendorAddRq.FirstName.SetValue("ab")
                        'Set field value for IsInactive
                        VendorAddRq.IsInactive.SetValue(True)
                        'Set field value for LastName
                        VendorAddRq.LastName.SetValue("ab")
                        'Set field value for Notes
                        VendorAddRq.Notes.SetValue("ab")
                        'Set field value for Phone
                        VendorAddRq.Phone.SetValue("ab")
                        'Set field value for Phone2
                        VendorAddRq.Phone2.SetValue("ab")
                        'Set field value for Phone3
                        VendorAddRq.Phone3.SetValue("ab")
                        'Set field value for Phone4
                        VendorAddRq.Phone4.SetValue("ab")
                        'Set field value for PostalCode
                        VendorAddRq.PostalCode.SetValue("ab")
                        'Set field value for Salutation
                        VendorAddRq.Salutation.SetValue("ab")
                        'Set field value for State
                        VendorAddRq.State.SetValue("ab")
                        'Set field value for Street
                        VendorAddRq.Street.SetValue("ab")
                        'Set field value for Street2
                        VendorAddRq.Street2.SetValue("ab")
                        'Set field value for TermsDiscount
                        VendorAddRq.TermsDiscount.SetValue(12.34)
                        'Set field value for TermsDiscountDays
                        VendorAddRq.TermsDiscountDays.SetValue(6)
                        'Set field value for TermsNetDays
                        VendorAddRq.TermsNetDays.SetValue(6)
                        'Set field value for VendorCode
                        VendorAddRq.VendorCode.SetValue("ab")
                        'Set field value for IncludeRetElementList
                        'May create more than one of these if needed
                        VendorAddRq.IncludeRetElementList.Add("ab")
                End Sub




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




                Public Sub WalkVendorRet(VendorRet as IVendorRet)
                        if (VendorRet is nothing) then
                                Exit Sub
                        End If

                        'Go through all the elements of IVendorRet
                        'Get value of ListID
                        if ( not VendorRet.ListID is nothing) then
                                Dim ListID4497 as String
                                ListID4497 = VendorRet.ListID.GetValue()
                        End If
                        'Get value of TimeCreated
                        if ( not VendorRet.TimeCreated is nothing) then
                                Dim TimeCreated4498 as DateTime
                                TimeCreated4498 = VendorRet.TimeCreated.GetValue()
                        End If
                        'Get value of TimeModified
                        if ( not VendorRet.TimeModified is nothing) then
                                Dim TimeModified4499 as DateTime
                                TimeModified4499 = VendorRet.TimeModified.GetValue()
                        End If
                        'Get value of AccountNumber
                        if ( not VendorRet.AccountNumber is nothing) then
                                Dim AccountNumber4500 as String
                                AccountNumber4500 = VendorRet.AccountNumber.GetValue()
                        End If
                        'Get value of City
                        if ( not VendorRet.City is nothing) then
                                Dim City4501 as String
                                City4501 = VendorRet.City.GetValue()
                        End If
                        'Get value of CompanyName
                        if ( not VendorRet.CompanyName is nothing) then
                                Dim CompanyName4502 as String
                                CompanyName4502 = VendorRet.CompanyName.GetValue()
                        End If
                        'Get value of Country
                        if ( not VendorRet.Country is nothing) then
                                Dim Country4503 as String
                                Country4503 = VendorRet.Country.GetValue()
                        End If
                        'Get value of EMail
                        if ( not VendorRet.EMail is nothing) then
                                Dim EMail4504 as String
                                EMail4504 = VendorRet.EMail.GetValue()
                        End If
                        'Get value of FirstName
                        if ( not VendorRet.FirstName is nothing) then
                                Dim FirstName4505 as String
                                FirstName4505 = VendorRet.FirstName.GetValue()
                        End If
                        'Get value of IsInactive
                        if ( not VendorRet.IsInactive is nothing) then
                                Dim IsInactive4506 as Boolean
                                IsInactive4506 = VendorRet.IsInactive.GetValue()
                        End If
                        'Get value of LastName
                        if ( not VendorRet.LastName is nothing) then
                                Dim LastName4507 as String
                                LastName4507 = VendorRet.LastName.GetValue()
                        End If
                        'Get value of Notes
                        if ( not VendorRet.Notes is nothing) then
                                Dim Notes4508 as String
                                Notes4508 = VendorRet.Notes.GetValue()
                        End If
                        'Get value of Phone
                        if ( not VendorRet.Phone is nothing) then
                                Dim Phone4509 as String
                                Phone4509 = VendorRet.Phone.GetValue()
                        End If
                        'Get value of Phone2
                        if ( not VendorRet.Phone2 is nothing) then
                                Dim Phone24510 as String
                                Phone24510 = VendorRet.Phone2.GetValue()
                        End If
                        'Get value of Phone3
                        if ( not VendorRet.Phone3 is nothing) then
                                Dim Phone34511 as String
                                Phone34511 = VendorRet.Phone3.GetValue()
                        End If
                        'Get value of Phone4
                        if ( not VendorRet.Phone4 is nothing) then
                                Dim Phone44512 as String
                                Phone44512 = VendorRet.Phone4.GetValue()
                        End If
                        'Get value of PostalCode
                        if ( not VendorRet.PostalCode is nothing) then
                                Dim PostalCode4513 as String
                                PostalCode4513 = VendorRet.PostalCode.GetValue()
                        End If
                        'Get value of Salutation
                        if ( not VendorRet.Salutation is nothing) then
                                Dim Salutation4514 as String
                                Salutation4514 = VendorRet.Salutation.GetValue()
                        End If
                        'Get value of State
                        if ( not VendorRet.State is nothing) then
                                Dim State4515 as String
                                State4515 = VendorRet.State.GetValue()
                        End If
                        'Get value of StoreExchangeStatus
                        if ( not VendorRet.StoreExchangeStatus is nothing) then
                                Dim StoreExchangeStatus4516 as ENStoreExchangeStatus
                                StoreExchangeStatus4516 = VendorRet.StoreExchangeStatus.GetValue()
                        End If
                        'Get value of Street
                        if ( not VendorRet.Street is nothing) then
                                Dim Street4517 as String
                                Street4517 = VendorRet.Street.GetValue()
                        End If
                        'Get value of Street2
                        if ( not VendorRet.Street2 is nothing) then
                                Dim Street24518 as String
                                Street24518 = VendorRet.Street2.GetValue()
                        End If
                        'Get value of Terms
                        if ( not VendorRet.Terms is nothing) then
                                Dim Terms4519 as String
                                Terms4519 = VendorRet.Terms.GetValue()
                        End If
                        'Get value of TermsDiscount
                        if ( not VendorRet.TermsDiscount is nothing) then
                                Dim TermsDiscount4520 as Single
                                TermsDiscount4520 = VendorRet.TermsDiscount.GetValue()
                        End If
                        'Get value of TermsDiscountDays
                        if ( not VendorRet.TermsDiscountDays is nothing) then
                                Dim TermsDiscountDays4521 as Integer
                                TermsDiscountDays4521 = VendorRet.TermsDiscountDays.GetValue()
                        End If
                        'Get value of TermsNetDays
                        if ( not VendorRet.TermsNetDays is nothing) then
                                Dim TermsNetDays4522 as Integer
                                TermsNetDays4522 = VendorRet.TermsNetDays.GetValue()
                        End If
                        'Get value of VendorCode
                        if ( not VendorRet.VendorCode is nothing) then
                                Dim VendorCode4523 as String
                                VendorCode4523 = VendorRet.VendorCode.GetValue()
                        End If
                        if (not VendorRet.DataExtRetList is nothing)
                                Dim i4524 as Integer
                                for i4524 = 0  to VendorRet.DataExtRetList.Count - 1
                                        Dim DataExtRet as IDataExtRet
                                        DataExtRet = VendorRet.DataExtRetList.GetAt(i4524)
                                        'Get value of OwnerID
                                        Dim OwnerID4525 as String
                                        OwnerID4525 = DataExtRet.OwnerID.GetValue()
                                        'Get value of DataExtName
                                        Dim DataExtName4526 as String
                                        DataExtName4526 = DataExtRet.DataExtName.GetValue()
                                        'Get value of DataExtType
                                        Dim DataExtType4527 as ENDataExtType
                                        DataExtType4527 = DataExtRet.DataExtType.GetValue()
                                        'Get value of DataExtValue
                                        Dim DataExtValue4528 as String
                                        DataExtValue4528 = DataExtRet.DataExtValue.GetValue()
                                Next i4524
                        End If
                End Sub




        End Class

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

using System;
using System.Net;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using Interop.qbposfc4;

namespace com.intuit.idn.samples
{
        public class SampleVendorAdd
        {
                public void  DoVendorAdd()
                {
                        bool sessionBegun = false;
                        bool connectionOpen = false;
                        QBPOSSessionManager sessionManager = null;

                        try
                        {
                                //Create the session Manager object
                                sessionManager = new QBPOSSessionManager();

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

                                BuildVendorAddRq(requestMsgSet);

                                //Connect to QuickBooks and begin a session
                                sessionManager.OpenConnection("","Sample Code from OSR");
                                connectionOpen = true;
                                sessionManager.BeginSession("");
                                sessionBegun = true;

                                //Send the request and get the response from QuickBooks
                                IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);

                                //End the session and close the connection to QuickBooks
                                sessionManager.EndSession();
                                sessionBegun = false;
                                sessionManager.CloseConnection();
                                connectionOpen = false;

                                WalkVendorAddRs(responseMsgSet);
                        }
                        catch (Exception e)
                        {
                                MessageBox.Show(e.Message, "Error");
                                if (sessionBegun)
                                {
                                        sessionManager.EndSession();
                                }
                                if (connectionOpen)
                                {
                                        sessionManager.CloseConnection();
                                }
                        }
                }
                void BuildVendorAddRq(IMsgSetRequest requestMsgSet)
                {
                        IVendorAdd VendorAddRq= requestMsgSet.AppendVendorAddRq();
                        //Set attributes
                        //Set field value for defMacro
                        VendorAddRq.defMacro.SetValue("IQBStringType");
                        //Set field value for AccountNumber
                        VendorAddRq.AccountNumber.SetValue("ab");
                        //Set field value for City
                        VendorAddRq.City.SetValue("ab");
                        //Set field value for CompanyName
                        VendorAddRq.CompanyName.SetValue("ab");
                        //Set field value for Country
                        VendorAddRq.Country.SetValue("ab");
                        //Set field value for EMail
                        VendorAddRq.EMail.SetValue("ab");
                        //Set field value for FirstName
                        VendorAddRq.FirstName.SetValue("ab");
                        //Set field value for IsInactive
                        VendorAddRq.IsInactive.SetValue(true);
                        //Set field value for LastName
                        VendorAddRq.LastName.SetValue("ab");
                        //Set field value for Notes
                        VendorAddRq.Notes.SetValue("ab");
                        //Set field value for Phone
                        VendorAddRq.Phone.SetValue("ab");
                        //Set field value for Phone2
                        VendorAddRq.Phone2.SetValue("ab");
                        //Set field value for Phone3
                        VendorAddRq.Phone3.SetValue("ab");
                        //Set field value for Phone4
                        VendorAddRq.Phone4.SetValue("ab");
                        //Set field value for PostalCode
                        VendorAddRq.PostalCode.SetValue("ab");
                        //Set field value for Salutation
                        VendorAddRq.Salutation.SetValue("ab");
                        //Set field value for State
                        VendorAddRq.State.SetValue("ab");
                        //Set field value for Street
                        VendorAddRq.Street.SetValue("ab");
                        //Set field value for Street2
                        VendorAddRq.Street2.SetValue("ab");
                        //Set field value for TermsDiscount
                        VendorAddRq.TermsDiscount.SetValue(12.34F);
                        //Set field value for TermsDiscountDays
                        VendorAddRq.TermsDiscountDays.SetValue(6);
                        //Set field value for TermsNetDays
                        VendorAddRq.TermsNetDays.SetValue(6);
                        //Set field value for VendorCode
                        VendorAddRq.VendorCode.SetValue("ab");
                        //Set field value for IncludeRetElementList
                        //May create more than one of these if needed
                        VendorAddRq.IncludeRetElementList.Add("ab");
                }




                void WalkVendorAddRs(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.rtVendorAddRs)
                                                {
                                                        //upcast to more specific type here, this is safe because we checked with response.Type check above
                                                        IVendorRet VendorRet = (IVendorRet)response.Detail;
                                                                WalkVendorRet(VendorRet);
                                                }
                                        }
                                }
                        }
                }




                void WalkVendorRet(IVendorRet VendorRet)
                {
                        if (VendorRet == null) return;
                        //Go through all the elements of IVendorRet
                        //Get value of ListID
                        if (VendorRet.ListID != null)
                        {
                                string ListID4529 = (string)VendorRet.ListID.GetValue();
                        }
                        //Get value of TimeCreated
                        if (VendorRet.TimeCreated != null)
                        {
                                DateTime TimeCreated4530 = (DateTime)VendorRet.TimeCreated.GetValue();
                        }
                        //Get value of TimeModified
                        if (VendorRet.TimeModified != null)
                        {
                                DateTime TimeModified4531 = (DateTime)VendorRet.TimeModified.GetValue();
                        }
                        //Get value of AccountNumber
                        if (VendorRet.AccountNumber != null)
                        {
                                string AccountNumber4532 = (string)VendorRet.AccountNumber.GetValue();
                        }
                        //Get value of City
                        if (VendorRet.City != null)
                        {
                                string City4533 = (string)VendorRet.City.GetValue();
                        }
                        //Get value of CompanyName
                        if (VendorRet.CompanyName != null)
                        {
                                string CompanyName4534 = (string)VendorRet.CompanyName.GetValue();
                        }
                        //Get value of Country
                        if (VendorRet.Country != null)
                        {
                                string Country4535 = (string)VendorRet.Country.GetValue();
                        }
                        //Get value of EMail
                        if (VendorRet.EMail != null)
                        {
                                string EMail4536 = (string)VendorRet.EMail.GetValue();
                        }
                        //Get value of FirstName
                        if (VendorRet.FirstName != null)
                        {
                                string FirstName4537 = (string)VendorRet.FirstName.GetValue();
                        }
                        //Get value of IsInactive
                        if (VendorRet.IsInactive != null)
                        {
                                bool IsInactive4538 = (bool)VendorRet.IsInactive.GetValue();
                        }
                        //Get value of LastName
                        if (VendorRet.LastName != null)
                        {
                                string LastName4539 = (string)VendorRet.LastName.GetValue();
                        }
                        //Get value of Notes
                        if (VendorRet.Notes != null)
                        {
                                string Notes4540 = (string)VendorRet.Notes.GetValue();
                        }
                        //Get value of Phone
                        if (VendorRet.Phone != null)
                        {
                                string Phone4541 = (string)VendorRet.Phone.GetValue();
                        }
                        //Get value of Phone2
                        if (VendorRet.Phone2 != null)
                        {
                                string Phone24542 = (string)VendorRet.Phone2.GetValue();
                        }
                        //Get value of Phone3
                        if (VendorRet.Phone3 != null)
                        {
                                string Phone34543 = (string)VendorRet.Phone3.GetValue();
                        }
                        //Get value of Phone4
                        if (VendorRet.Phone4 != null)
                        {
                                string Phone44544 = (string)VendorRet.Phone4.GetValue();
                        }
                        //Get value of PostalCode
                        if (VendorRet.PostalCode != null)
                        {
                                string PostalCode4545 = (string)VendorRet.PostalCode.GetValue();
                        }
                        //Get value of Salutation
                        if (VendorRet.Salutation != null)
                        {
                                string Salutation4546 = (string)VendorRet.Salutation.GetValue();
                        }
                        //Get value of State
                        if (VendorRet.State != null)
                        {
                                string State4547 = (string)VendorRet.State.GetValue();
                        }
                        //Get value of StoreExchangeStatus
                        if (VendorRet.StoreExchangeStatus != null)
                        {
                                ENStoreExchangeStatus StoreExchangeStatus4548 = (ENStoreExchangeStatus)VendorRet.StoreExchangeStatus.GetValue();
                        }
                        //Get value of Street
                        if (VendorRet.Street != null)
                        {
                                string Street4549 = (string)VendorRet.Street.GetValue();
                        }
                        //Get value of Street2
                        if (VendorRet.Street2 != null)
                        {
                                string Street24550 = (string)VendorRet.Street2.GetValue();
                        }
                        //Get value of Terms
                        if (VendorRet.Terms != null)
                        {
                                string Terms4551 = (string)VendorRet.Terms.GetValue();
                        }
                        //Get value of TermsDiscount
                        if (VendorRet.TermsDiscount != null)
                        {
                                float TermsDiscount4552 = (float)VendorRet.TermsDiscount.GetValue();
                        }
                        //Get value of TermsDiscountDays
                        if (VendorRet.TermsDiscountDays != null)
                        {
                                int TermsDiscountDays4553 = (int)VendorRet.TermsDiscountDays.GetValue();
                        }
                        //Get value of TermsNetDays
                        if (VendorRet.TermsNetDays != null)
                        {
                                int TermsNetDays4554 = (int)VendorRet.TermsNetDays.GetValue();
                        }
                        //Get value of VendorCode
                        if (VendorRet.VendorCode != null)
                        {
                                string VendorCode4555 = (string)VendorRet.VendorCode.GetValue();
                        }
                        if (VendorRet.DataExtRetList != null)
                        {
                                for (int i4556 = 0; i4556 < VendorRet.DataExtRetList.Count; i4556++)
                                {
                                        IDataExtRet DataExtRet = VendorRet.DataExtRetList.GetAt(i4556);
                                        //Get value of OwnerID
                                        string OwnerID4557 = (string)DataExtRet.OwnerID.GetValue();
                                        //Get value of DataExtName
                                        string DataExtName4558 = (string)DataExtRet.DataExtName.GetValue();
                                        //Get value of DataExtType
                                        ENDataExtType DataExtType4559 = (ENDataExtType)DataExtRet.DataExtType.GetValue();
                                        //Get value of DataExtValue
                                        string DataExtValue4560 = (string)DataExtRet.DataExtValue.GetValue();
                                }
                        }
                }




        }
}