XeroAPI/XeroAPI.Net — Issue #9: Invoices have no line items
Author: ExtraNerds
Created: 2011-12-19 05:08:27+00:00
State: open

The following code will return a list of invoices from Xero and iterate through them:

Dim certPassword As String = "password"
Dim certFile As String = "filename"
Dim userAgent As String = "User Agent"
Dim consumerKey As String = "CONSUMERKEY"
Dim signingCertificate As New System.Security.Cryptography.X509Certificates.X509Certificate2(certFile, certPassword)
Dim session As DevDefined.OAuth.Consumer.IOAuthSession = New XeroApi.OAuth.XeroApiPrivateSession(userAgent, consumerKey, signingCertificate)
Dim repo As New XeroApi.Repository(session)
For Each invoice In repository.Invoices
'do something here
Next

However, the "LineItems" property of each "invoice" is "Nothing" (empty), even though there are line items associated with the invoice in Xero. This prevents one from reading an existing draft invoice from Xero and appending new line items.