How to enable .net to access Quickbooks company file

H
To do this You should have :
A) QuickBooksEnterprise (here we used 13)
B) QBSDK  (here we used  12.0)
c) Microsoft Visual Studio 2008

How we can do ?
a.  Open Connection to QuickBooks
b.  Begin session with a company file
c.  Construct set of request messages
d.  Send request to QuickBooks
e.  Receive response messages
f.   End session
g.  Close connection

a. Open Connection to QuickBooks
:
QBSessionManager mgr = new QBSessionManager();
mgr.OpenConnection(“appID”, “appName”);
/* appID, appName are String Type
appID: empty string for now
»Intended to eventually allow QuickBooks to link to a listing on Solutions Marketplace
appName: name to appear in QuickBooks

b. Begin session with a company file
:
mgr.BeginSession(@”pathfilename.qbw”, ENOpenMode.omDontCare);
/*  companyFile: path to the company to open
openMode: an enum of desired file mode
»qbFileOpenSingleUser / omSingleUser
»qbFileOpenMultiUser / omMultiUser
»qbFileOpenDoNotCare / omDontCare        */

c. Construct set of request messages
:
IMsgSetRequest setrq = mgr.CreateMsgSetRequest(“Contry_Name”,            qbXMLMajorVersion, qbXMLMinorVersion);
/*Contry_Name : String Type
qbXMLMajorVersion : short Type
qbXMLMinorVersion : short Type   */
Ex. to apeend request:
ICustomerAdd custadd = setrq.AppendCustomerAddRq();
custadd.Name.SetValue(“ABC infotech”);
custadd.CompanyName.SetValue(“ABC infotech”);
custadd.OpenBalance.SetValue(70000);

d.Send request to QuickBooks
:
IMsgSetResponse setres = mgr.DoRequests(setrq);

e. Receive response messages
:
count the total Responses in responseList
int count =  setres.ResponseList.Count – 1;
Receive  the response which you want
IResponse response = setres.ResponseList.GetAt(i);

f. End Seession
:
mgr.EndSession();

g. Close Connection
:
mgr.CloseConnection();

 

After this open your Quickbook Company file in Quickbooks. then run the above code.

 

About the author

kalpesh.surana
By kalpesh.surana

Category