BASIC Developer & Support Resources > VB (5/6/CE) Classic

Quickbooks SDK

<< < (2/3) > >>

John:
I forgot about Dave's COM object interface viewer addition.


Interface: IQBSessionManager
ProgID: QBFC13.QBSessionManager.1
CLSID: {22E885D7-FB0B-49E3-B905-CCA6BD526B52}
Sub OpenConnection(AppID As String, AppName As String)
Sub BeginSession(qbFile As String, openMode As ENOpenMode)
Sub EndSession()
Sub CloseConnection()
Function GetCurrentCompanyFileName() As String
Function CreateMsgSetRequest(Country As String, qbXMLMajorVersion As Integer, qbXMLMinorVersion As Integer) As Object
Function ToMsgSetResponse(qbXMLResponse As String, Country As String, qbXMLMajorVersion As Integer, qbXMLMinorVersion As Integer) As Object
Function DoRequests(request As Object) As Object
Sub GetVersion(MajorVersion As Object, MinorVersion As Object, releaseLevel As Object, releaseNumber As Object)
Function DoRequestsFromXMLString(qbXMLRequest As String) As Object
Get QBXMLVersionsForSession() As Array
Function CreateSubscriptionMsgSetRequest(qbXMLMajorVersion As Integer, qbXMLMinorVersion As Integer) As Object
Function ToSubscriptionMsgSetResponse(qbXMLSubscriptionResponse As String, qbXMLMajorVersion As Integer, qbXMLMinorVersion As Integer) As Object
Function DoSubscriptionRequests(request As Object) As Object
Function DoSubscriptionRequestsFromXMLString(qbXMLSubscriptionRequest As String) As Object
Function ToEventsMsgSet(qbXMLEventsResponse As String, qbXMLMajorVersion As Integer, qbXMLMinorVersion As Integer) As Object
Function ToMsgSetRequest(qbXMLRequest As String) As Object
Function IsErrorRecoveryInfo() As Boolean
Sub ClearErrorRecovery()
Let EnableErrorRecovery(Boolean)
Get EnableErrorRecovery() As Boolean
Let SaveAllMsgSetRequestInfo(Boolean)
Get SaveAllMsgSetRequestInfo() As Boolean
Function GetErrorRecoveryStatus() As Object
Function GetSavedMsgSetRequest() As Object
Get ErrorRecoveryID() As Object
Get ConnectionType() As ENConnectionType
Sub OpenConnection2(AppID As String, AppName As String, connType As ENConnectionType)
Get QBAuthPreferences() As Object
Sub CommunicateOutOfProcess(useOutOfProc As Boolean)
Sub CommunicateOutOfProcessEx(useOutOfProc As Boolean, outOfProcCLSID As String)
Get QBXMLVersionsForSubscription() As Array



--- Code: Script BASIC ---import com.inc oQBSession = CreateObject("QBFC13.QBSessionManager") print "Typename = ", TypeName(oQBSession), "\n" print "Launching DescribeInterface dialog...\n"DescribeInterface oQBSession  print "Shutting down QuickBooks and releasing object...\n"CallByName(oQBSession, "Quit")ReleaseObject(oQBSession) 
According to the interface viewer, BeginSession is a SUB and doesn't return a value.

I also found this reference for the QBFC13.dll. (QuickBooks SDK Foundation Classes)

John:
I found this code snippet in the QBFC Programmers Guide.


--- Quote ---Some Commentary on the QBFC Code Snippet

The same commentary provided for the qbXML snippet above applies here. One interesting difference you’ll notice is the absence of the session ticket when you use QBFC. That is managed automatically by QBFC

--- End quote ---

QBSDK_ProGuide.pdf

John:
I think I'm close. All I need to do now is figure out how to return a string response from the object being returned. I know it's working due to the delay reading the QuickBooks database and building the response buffer.


--- Code: Script BASIC ---import COM.inc oqbXMLRP = CreateObject("QBFC13.QBSessionManager.1")PRINT "oqbXMLRP: ", oqbXMLRP,"\n" CallByName(oqbXMLRP, "OpenConnection", vbMethod, "", "Script BASIC")CallByName(oqbXMLRP, "BeginSession", vbMethod, "", 2) xml_request = """<?qbxml version="8.0"?><QBXML>   <QBXMLMsgsRq onError="stopOnError">      <AccountQueryRq requestID="1">      </AccountQueryRq>   </QBXMLMsgsRq></QBXML>""" response = CallByName(oqbXMLRP, "DoRequestsFromXMLString", vbMethod, xml_request) PRINT response,"\n" CallByName(oqbXMLRP, "EndSession", vbMethod)CallByName(oqbXMLRP, "CloseConnection", vbMethod) 

C:\qbooks>scriba getaccounts.sb
oqbXMLRP: 22304124
22307888

C:\qbooks>


QBFC Quick Reference

John:
Success!


--- Code: Script BASIC ---IMPORT COM.inc oqbXMLRP = VBNEW("QBFC13.QBSessionManager.1")VBCALL oqbXMLRP, "OpenConnection", vbMethod, "", "Script BASIC"VBCALL oqbXMLRP, "BeginSession", vbMethod, "", 2 xml_request = """<?qbxml version="8.0"?><QBXML>   <QBXMLMsgsRq onError="stopOnError">      <AccountQueryRq requestID="1">      </AccountQueryRq>   </QBXMLMsgsRq></QBXML>""" oResponse = VBCALL(oqbXMLRP, "DoRequestsFromXMLString", vbMethod, xml_request)xml_str = VBCALL(oResponse, "ToXMLString", vbMethod) PRINT xml_str,"\n" VBCALL oqbXMLRP, "EndSession", vbMethodVBCALL oqbXMLRP, "CloseConnection", vbMethodVBREL oResponseVBREL oqbXMLRP 

Note: Full response too large to post. This is the end of the response string returned.

<AccountRet>
<ListID>6A0002-1047416097</ListID>
<TimeCreated>2003-03-11T13:54:57-08:00</TimeCreated>
<TimeModified>2017-12-15T04:37:17-08:00</TimeModified>
<EditSequence>1513341437</EditSequence>
<Name>Purchase Orders</Name>
<FullName>Purchase Orders</FullName>
<IsActive>true</IsActive>
<Sublevel>0</Sublevel>
<AccountType>NonPosting</AccountType>
<SpecialAccountType>PurchaseOrders</SpecialAccountType>
<AccountNumber>2</AccountNumber>
<Balance>0.00</Balance>
<TotalBalance>0.00</TotalBalance>
<CashFlowClassification>NotApplicable</CashFlowClassification>
</AccountRet>
<AccountRet>
<ListID>8B0002-1047429302</ListID>
<TimeCreated>2003-03-11T17:35:02-08:00</TimeCreated>
<TimeModified>2017-12-15T04:37:17-08:00</TimeModified>
<EditSequence>1513341437</EditSequence>
<Name>Sales Orders</Name>
<FullName>Sales Orders</FullName>
<IsActive>true</IsActive>
<Sublevel>0</Sublevel>
<AccountType>NonPosting</AccountType>
<SpecialAccountType>SalesOrders</SpecialAccountType>
<AccountNumber>5</AccountNumber>
<Balance>0.00</Balance>
<TotalBalance>0.00</TotalBalance>
<CashFlowClassification>NotApplicable</CashFlowClassification>
</AccountRet>
</AccountQueryRs>
</QBXMLMsgsRs>
</QBXML>


C:\qbooks>

Mike Lobanovsky:
Congrats! :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version