How do I import Quick Books data? - c#

I heard that using Quick book SDK we can import Quick Books data in our own application using C#.
Let me know how is this possible.
I am developing desktop applicaton using Silverlight.
This a SaaS app (I am allowing customers to connect their QuickBooks files to my app)
Are there any resources to go through (any links, examples)?

Go install the QuickBooks SDK.
After installation, navigate to this directory on your computer:
C:\Program Files (x86)\Intuit\IDN\QBSDK12.0\samples\qbdt\c-sharp
In that directory you will find many examples, provided by Intuit, which show how to do this. In addition, you'll find about 600 pages of PDF documentation included with the SDK, which detail every single aspect of what you're trying to do.
Desktop connections to QuickBooks using C# and the SDK are pretty easy - you basically set up a COM object and feed XML to QuickBooks. QuickBooks processes the XML request and sends you back an XML response.
Here's some QuickBooks C# example code.
rp = new RequestProcessor2();
rp.OpenConnection("", "IDN CustomerAdd C# sample");
ticket = rp.BeginSession("C:\\path\\to\\file.QBW", QBFileModeE.qbFileOpenDoNotCare);
//ticket = rp.BeginSession("C:\\path\\to\\file.QBW", QBFileMode.qbFileOpenDoNotCare);
Random random = new Random();
string input = #"<?xml version=""1.0"" encoding=""utf-8""?>
<?qbxml version=""2.0""?>
<QBXML>
<QBXMLMsgsRq onError=""stopOnError"">
<CustomerAddRq requestID=""15"">
<CustomerAdd>
...
</CustomerAdd>
</CustomerAddRq>
</QBXMLMsgsRq>
</QBXML>";
response = rp.ProcessRequest(ticket, input);
You should refer to the QuickBooks OSR for details on the XML requests you can send. Also included in the SDK is the QBFC library, which allows you to create the XML requests with objects, and marshall the object to an XML string.

Related

.net Maui android how to retrieve file from external fileserver

I am making an app that allows you to open and edit a pdf file on tablets. Because i usually work with .NET, i decided to write it in .NET MAUI. That way i also have access to windows tablets.
It uses Itext as its main library to read and edit the pdf's.
I have an external shared fileserver that anyone can access when they are coneected to the WIFI.
I'd like to access that fileserver when i connect from my android tablet using Itext pdfreader.
How do I achieve this correctly?
Am i missing a library or a package which would allow to me to access that file?
Are there options i haven't discovered yet?
This works on windows tablets:
string dest "\\\\Path\\to\\File\\";
string file = "\\\\Path\\to\\File\\file.pdf";
PdfDocument pdfDoc = new PdfDocument(new PdfReader(file), new PdfWriter(dest));
I have tried :
string file = Environment.GetFolderPath(Environment.SpecialFolder.Windows)+ "\\Path\to\File\file.pdf";
string file = "\\\\Path\\to\\File\\file.pdf";
All of them result in file not found
Among the getfolderpath options ive tried a dozen, none of them seem to work.
thank you for your time
So i ended up solving this by transforming the document into a base64 string and sending it through an api that i had.
i used the classic httprequest aproach that you can look up and copy anywhere.

QBXML - How do I go about adding brand new items on the fly when i modify an Invoice using InvoiceModRq?

<?xml version="1.0" encoding="utf-16"?><?qbxml version="13.0"?><QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceModRq>
<InvoiceMod>
<TxnID>983C-1639586336</TxnID>
<EditSequence>1639586895</EditSequence>
<RefNumber>308_17</RefNumber>
<Other>INVU</Other>
<InvoiceLineMod>
<TxnLineID>-1</TxnLineID>
<ItemRef>
<FullName>MP3-C </FullName>
</ItemRef>
<Desc>Harley Davidson 1950 80hp bike </Desc>
<Quantity>1.00</Quantity>
<Amount>5.00</Amount>
<Other1>308_17</Other1>
<Other2>13041</Other2>
</InvoiceLineMod>
</InvoiceMod>
</InvoiceModRq>
</QBXMLMsgsRq>
</QBXML>
At the company where I work, we have the following technologies in Dev environment - company's own C# web application called companyABCDevapplication - installation of Quick Books Web Connector - installation of Quick books Quickbooks Desktop 2017 Premier Trial Version
I've been tasked with creating an interfacing Web service that will be invoked by a Quick Books Web Connector Installation to communicate with our companyABCDevapplication
Here are the technologies being used for local development:
Intuit Quickbooks Desktop 2017 Premier Trial Version
Intuit QuickBooks Web Connector Version 2.2.0.71
Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET FrameworkVersion 4.6.01055
Unfortunately, when I send the XML shown at the top of this post to Quickbooks Web connector, I get the following error:
<?xml version=\"1.0\" ?><QBXML>
<QBXMLMsgsRs>
<InvoiceModRs statusCode=\"3140\" statusSeverity=\"Error\" statusMessage=\"There is an invalid reference to QuickBooks Item "MP3-C" in the Invoice. \" />
</QBXMLMsgsRs>
</QBXML>
I wanted to modify an Invoice withOut worrying about whether the ItemRef in questionis already known by Quickbooks. I basically want to new Item that have Not been entered into Quickbooks by using ItemInventoryAdd tags or ItemNonInventoryAdd tags. How do I go about adding brand new items on the fly when i modify an Invoice using InvoiceModRq?
How do I go about adding brand new items on the fly when i modify an Invoice using InvoiceModRq?
You can't.
QuickBooks does not allow you to do what you're trying to do.
What you can do, is sort of fudge it by ALWAYS sending a ItemInventoryAddRq immediately preceding your InvoiceAddRq or InvoiceModRq node, to essentially always try to re-create the item prior to doing your invoice.
If the item already exists, the add will fail with an error, but the next request will still be processed.
If you do this bundled in a single QBXMLMsgsRq then you'll want to make sure you use:
onError="continueOnError"
Instead of:
onError="stopOnError"
So that QuickBooks continues processing the rest of the requests even if the item add requests fail.

Get last modified date of a remote file

I have an app with which at startup it downloads a file from a remote location (through the net) and parses it's contents.
I am trying to speed up the process of startup as the bigger the file gets the slower the app starts.
As a way to speed up the process I thought of getting the last modified date of the file and if it is newer from the file on the user's pc then and only then download it.
I have found many ways to do it online but none of them are in C# (for windows store apps). Does anybody here know of a way of doing this without the need to download the file? If I am to download the file then the process is sped up at all.
My C# code for downloading the file currently is this
const string fileLocation = "link to dropbox";
var uri = new Uri(fileLocation);
var downloader = new BackgroundDownloader();
StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync("feedlist.txt",CreationCollisionOption.ReplaceExisting);
DownloadOperation download = downloader.CreateDownload(uri, file);
await download.StartAsync();
If it helps the file is stored in dropbox but if any of you guys have a suggestion for another free file hosting service I am open to suggestions
Generally, you can check the file time by sending HEAD request and parsing/looking HTTP header response for a Last-Modified filed. The remote server should support it and DropBox does not support this feature for direct links (only via API). But DropBox have another feature, the headers have the etag field. You should store it and check in the next request. If it changed - the file has been changed too. You can use this tool to check the remote file headers.

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 recommend you look at #Keith Palmer Jr.'s answer below which much more helpful than this one. I can't delete this one since it was accepted.
Original answer:
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!

Index pdf documents in Solr from C# client

Basically I'm trying to index word or pdf documents in Solr and found the ExtractingRequestHandler, but can't figure out how to write code in c# that performs the HTTP POST request like in the Solr wiki: http://wiki.apache.org/solr/ExtractingRequestHandler.
I've installed Solr 3.4 on Tomcat 7 (7.0.22) using the files from the example/solr directory in the Solr zip and I haven't altered anything. The ExtractingRequestHandler should be configured out of the box in the solrconfig.xml and ready to use, right?
Can some of you give an C# (HttpWebRequest) example of how you make the HTTP POST request and upload a PDF file like it is done using curl in the Solr wiki?
I've look all over this site and many others trying to find an example or a tutorial on how this is done, but haven't found anything.
EDIT:
I finally managed to get it to work using SolrNet!
In order for it to work you need to copy this to a lib-folder in your Solr installation directory from the Solr zip:
apache-solr-cell-3.4.0.jar file from the dist folder
content of contrib\extraction\lib directory
With SolrNet 0.4.0 beta 2, this code does the job:
Startup.Init<IndexDocument>("YOUR-SOLR-SERVICE-PATH");
var solr = ServiceLocator.Current.GetInstance<ISolrOperations<IndexDocument>>();
using (FileStream fileStream = File.OpenRead("FILE-PATH-FOR-THE-FILE-TO-BE-INDEXED"))
{
var response =
solr.Extract(
new ExtractParameters(fileStream, "doc1")
{
ExtractFormat = ExtractFormat.Text,
ExtractOnly = false
});
}
solr.Commit();
Sorry for the trouble. I hope however that others will find this useful.
I would recommend using the SolrNet client. It supports the ExtractingRequestHandler.

Categories