简体   繁体   中英

integration asp.net application with quickbooks desktop edition

I have an asp.net application and i want to connect it to quickbooks desktop edition , in the web application i want to do the below : 1- get Customers list from quickbooks. 2- create new invoice and save send it to quickbooks.

this is what i found of sample code but i would like to what is the value that i have to set in the AppId parameters in the (sessionManager.BeginSession("", ENOpenMode.omDontCare);).

private void getCustomers()
{
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", 8,      0);
            requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;

            //Connect to QuickBooks and begin a session
            sessionManager.OpenConnection(@"D:\A to Z Wholesale Inc.QBW", "QuickBooks Integration Demo");
            connectionOpen = true;
            sessionManager.BeginSession("", ENOpenMode.omDontCare);
            sessionBegun = true;

            ICustomerAdd customerAddRq = requestMsgSet.AppendCustomerAddRq();
            customerAddRq.Name.SetValue("Amer");
            ICustomerQuery customer = requestMsgSet.AppendCustomerQueryRq();
            //Send the request and get the response from QuickBooks
            IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
            IResponse response = responseMsgSet.ResponseList.GetAt(0);
            ICustomerRet customerRet = (ICustomerRet)response.Detail;
        }
        catch (Exception ex)
        {

        }
        finally
        {
            //End the session and close the connection to QuickBooks
            if (sessionBegun)
            {
                sessionManager.EndSession();
            }
            if (connectionOpen)
            {
                sessionManager.CloseConnection();
            }
        }

}

Your approach using COM probably will not work.

The QuickBooks SDK/API is a little stupid in that it uses a Windows COM GUI message pump to do it's dirty work of actually communicating with QuickBooks. That means that a Windows GUI must be present in order for data exchange with QuickBooks to happen.

That's going to be a problem for you, because you're building a web application... which will run inside of IIS, and thus won't have a Windows GUI session available to it.

If you're building a SaaS application, were the goal is to allow multiple other people to connect their QuickBooks files to your web application:

Consider looking at the Intuit Partner Platform/Intuit Anywhere . Be aware that this is only available for SaaS type apps. The basic idea is that people sync their QuickBooks data files up to Intuit's cloud, and then you can use REST web services to exchange data.

Intuit even has some helpful DevKits which provide some sample code and objects/methods to do your data exchange.

Otherwise, if you're not going the Intuit Anywhere route, look at the QuickBooks Web Connector:

The whole point of the QuickBooks Web Connector is to enable integrations like the one you're doing.

Here's a good overview of the QuickBooks Web Connector . It's basically a simple SOAP wrapper around the qbXML schema that QuickBooks understands natively.

If you download the QuickBooks SDK there's some sample code in this folder: C:\\Program Files (x86)\\Intuit\\IDN\\QBSDK12.0\\samples\\qbdt

There's .NET sample code for the Web Connector in there, which should be helpful.

I found this webpage: QuickBooks Integration (Mad Computer Scientist)

which says you can use anything:

When opening a connection, you need to specify an application identification ID and name. This will be shown to the user in QuickBooks to allow/disallow the access. These are strings and, so far as I can tell, no checks are run, allowing the user to put anything here that they care to.

The "shown to the user" bit implies you may need to use AutoIt or similar to dismiss a dialog box if you're using this on an ASP.NET server!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM