How to Integrate with QuickBooks Desktop

by Martin Pellicore
How to Integrate with QuickBooks Desktop

QuickBooks Desktop is one of the most prominent accounting and payroll software packages available today for small and medium sized businesses. It’s robust, secure, scalable and easy to use. However, by nature of QuickBooks Desktop being deployed on a Windows desktop environment—it’s also siloed, hard to access, and difficult to integrate with your third-party systems.

So, if you’re asking yourself—

  • “Can I integrate my other software with QuickBooks Desktop?”
  • “How can I get data from QuickBooks Desktop into my PowerBI platform?”
  • “Is it possible to sync timsheet data to QB Desktop?”

The answer, is “Yes, of course!”… And you’ve come to the right place to find out how!

First…A lesson in legacy software!

Legacy software, as unappealing as it may be, is all around us. Old platforms, servers, applications and environments are still the foundation of nearly every business. As much as we invest in newer technologies like the cloud, we still heavily rely on older technology to get us through our work week.

One lesson we are constantly reminded of in the software development industry is this:

Legacy software is always around for longer than we think it will be. It’s always doing something crucial to our business that we didn’t think it was doing and for that reason, it’s always harder to migrate than we think it is.

But, there is hope! There are downsides to older, desktop-based software, sure. But, there are still ways to integrate it with your other software platforms to help your business run smooth and eliminate pesky bottlenecks like manual time entry and transaction reconciliation…

Okay, let’s get to the point…

We get it, you’re here to learn how to integrate with QuickBooks Desktop. Well, you’ve come to the right place. Pell Software is an expert in developing integrations with QuickBooks Desktop (and QuickBooks Online, for that matter) and we’ve written this article in order to help you find your way!

If you’re just starting out researching the topic, you’ve probably run into articles about the QuickBooks Web Connector and if you’ve been researching this topic for long enough, perhaps you’ve even run into information about the QuickBooks SDK. The SDK, although it does have its limitations, is generally regarded as the more powerful approach to integrating. For that reason, we’ll focus on how to integrate with the SDK, and leave the details surrounding why to another article: Should I Use The QuickBooks Web Connector or SDK?

What is an “SDK” anyways?

Software Development Kit

An SDK is a library of code written and packaged together with the intention of making a specific programming task easier. Think of an SDK like the tool kit that comes with your new Ikea dresser. Ikea has a pretty good idea of what tools you’re going to need to build their dresser (at least, they think they do) and so they include them, free of charge, when you purchase the dresser. The tools make building the dresser a lot easier, because now you don’t need to be a carpenter to put the thing together (no, you just need to be patient, diligent, thorough, detailed and dexterous; did I mention patient?…)

Anyways. In the case of the QuickBooks SDK, Intuit has published it for free in the hopes that it helps developers build integrations with QuickBooks Desktop—and it does. This, in turn, increases the extensibility and availability of the QB Desktop system, and of course, increases its value.

How do I use the SDK?

This section will focus on the technical aspects of using the Intuit QuickBooks SDK to integrate with QuickBooks. If you’re not familiar with the terminology used here, that’s okay, just go ahead and skip to the end!

To get started, we’ll assume you have coding experience in C# and have Visual Studio installed in your development environment.

1. Install the SDK

Open Visual Studio, create a new solution for your integration, and head right over to NuGet Package Manager by right-clicking on your project in Visual Studio and clicking Manage NuGet Packages...

Type in: interop qbfc into the search bar, and you will see the results below. Pick the appropriate package and install Interop.QBFC15.

You’ll notice the Interop.QBFC13 is listed as well, which is an older version of the SDK, however, we recommend using v15 going forward because it adds a lot of additional functionality on top of the older versions of the SDK.

You can read about all of the changes and feature additions here and you can download all older versions of the SDK here.

2. Connect to QuickBooks Desktop

Using the code snippet below, open the connection to QuickBooks Desktop…

QBSessionManager qbSessionManager = serviceProvider.GetService<QBSessionManager>();

// Open connection, giving it an App ID and App Name
qbSessionManager.OpenConnection2("Pell.QBDIntegration", "Pell.QBDIntegration QuickBooks Connector", ENConnectionType.ctLocalQBD);

// Open the session, passing in the file path to the company file and specifying an Open Mode
qbSessionManager.BeginSession(QBDCompanyFilePath, ENOpenMode.omDontCare);

Make sure you have QB Desktop open with your company file open the first time that the code above executes. QuickBooks will then prompt you to authenticate your application through a series of popup windows. This is where you will have the opportunity to choose the permissions the application will receive including as how/when it’s allowed to connect to QuickBooks and which user (and therefore, permissions) it will assume.

3. Query For Vendors (example)

Now that you have the QBSessionManager instantiated and connected, you can do anything you’d like!

The code below is a full example of how to connect to QuickBooks Desktop via the QBFC SDK, query for all Vendors in the QuickBooks company file, and loop through them to do something…

IServiceProvider serviceProvider = Configure(args);            
QBSessionManager qbSessionManager = serviceProvider.GetService<QBSessionManager>();

try
{
// Open connection, giving it an App ID and App Name
qbSessionManager.OpenConnection2("Pell.QBDIntegration", "Pell.QBDIntegration QuickBooks Connector", ENConnectionType.ctLocalQBD);

// Open the session, passing in the file path to the company file and specifying an Open Mode
qbSessionManager.BeginSession(QBDCompanyFilePath, ENOpenMode.omDontCare);

// Example: List all Vendors from QBD
IMsgSetRequest vendorQueryRequest = qbSessionManager.CreateMsgSetRequest("US", 15, 0);
vendorQueryRequest.Attributes.OnError = ENRqOnError.roeContinue;

IVendorQuery query = vendorQueryRequest.AppendVendorQueryRq();
query.ORVendorListQuery.VendorListFilter.ActiveStatus.SetValue(ENActiveStatus.asAll); // Filter for only Active Vendors
query.OwnerIDList.Add("0");

// Execute the query request
IMsgSetResponse resp = qbSessionManager.DoRequests(vendorQueryRequest);

    // Get the results into memory
    if (resp.ResponseList.GetAt(0).StatusCode == 0)
    {
	IVendorRetList listRet = (IVendorRetList)resp.ResponseList.GetAt(0).Detail;
	if (listRet != null)
	{
		// Loop the Vendor results
		for (int i = 0; i < listRet.Count; i++)
		{
			// Do something...
		}
	}
    }
}
catch (Exception ex)
{
    // Log Error...
    return;
}
finally
{
    // Don't forget to end the session and close your connection, otherwise QB Desktop won't let the user close the application!
    qbSessionManager.EndSession();
    qbSessionManager.CloseConnection();
}

Pell Software is a QB Desktop Integration Expert

As you can see, the nuts and bolts of the integration are actually rather simple. The trickiest part of any data integration is always the design (or architecture) of the data pipeline. Answering questions like:

  • Which direction should the data flow? Should it be uni-directional or bi-directional?
  • How often should the data be synced?
  • How will the integration match items in one system to the items in QuickBooks Desktop to ensure we don’t create duplicates?
  • Do I need a separate server to run the sync from?
  • Will it bog down my machine?

These questions are critical to the success of your QuickBooks integration project, and at Pell Software we have been answering these questions and solving these problems for years!

When it comes to QuickBooks integrations, or any other API or accounting platform integration for that matter, Pell Software is far and away the industry leader. We have worked with QuickBooks Online, QuickBooks Enterprise; as well as many other ERP and accounting platforms such as Sage 100, Sage 300, Sage Intacct, Acumatica, NetSuite, Salesforce, and many more!

Talk to a QB Integration Expert Today!

Fill out the form below to schedule your free 30 minute consultation.