Jeet Bhatt
Jeet Bhatt

Reputation: 778

How to get customers details using Quickbooks QBXML

I used QuickBooks API. Through this API i try to get all customer details like FullName, Addresses(Addr1,Addr2....), City, State, PostalCode etc.

Below is my code:

RequestProcessor2Class rp = new RequestProcessor2Class();


public void connectToQB()
        {
            rp = new RequestProcessor2Class();
            rp.OpenConnection(appID, appName);
            ticket = rp.BeginSession(companyFile, mode);
            string[] versions = rp.get_QBXMLVersionsForSession(ticket);
            maxVersion = versions[versions.Length - 1];
        }

public string processRequestFromQB(string request)
        {
            try
            {
                return rp.ProcessRequest(ticket, request);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return null;
            }
        }


string request = "CustomerQueryRq";
            objConnect.connectToQB();
            int count = objConnect.getCount(request);
            string response = objConnect.processRequestFromQB(objConnect.buildCustomerQueryRqXML(new string[] { "FullName", "City" }, null));
            string[] customerList = objConnect.parseCustomerQueryRs(response, count);
            objConnect.disconnectFromQB();

Let me know if you want more information.

Thanks,

Upvotes: 0

Views: 1300

Answers (1)

Chanakan
Chanakan

Reputation: 21

This is a sample code for get customer name.

   ICustomerRetList customerRetList = (ICustomerRetList)response.Detail;
   ICustomerRet customerRet = customerRetList.GetAt(0);
   textBox1.Text = customerRet.Name.GetValue().ToString();

Please learn more.

->> for get other detail.

Upvotes: 1

Related Questions