Guillermo Oramas R. Guillermo Oramas R. - 3 months ago 27
ASP.NET (C#) Question

Send email with invoice in Quickbook with .net SDK

I'm using SDK V3 for .net

IppDotNetSdkForQuickBooksApiV3
and trying to send the email with the invoice after I create it (which I found weird that the Quickbook doesn't do it automatically after I create the invoice, so maybe I'm doing something wrong).

So this is how it goes:

//Get customer
var customerQueryService = new QueryService<Customer>(context);
var customer = customerQueryService.ExecuteIdsQuery("query to get customer");
/*I fill the invoice with data
..
..
..*/
//Call to generate invoice
var invoiceAdded = dataService.Add(invoice);
//Email to send
invoiceAdded.BillEmail = customer.PrimaryEmailAddr;
invoiceAdded.EmailStatus = EmailStatusEnum.NeedToSend;
invoiceAdded.EInvoiceStatusSpecified = true;
//Send Email
dataService.SendEmail(invoiceAdded);


This is where I'm getting troubles, first I notices that the object from
customer.PrimaryEmailAddr
has no
id
:

enter image description here

So when I'm gonna make the call to send the email after I created the invoice I get the following exception:

Object not found: EmailAddress


enter image description here

If I go to my Quickbook site I do have my customer of course and that is his email.

So what I'm doing wrong?

Answer

Try this:

//Call to generate invoice

var invoiceAdded = dataService.Add(invoice);

//Send Email

dataService.SendEmail<Invoice>(invoiceAddded, customer.PrimaryEmailAddr.Address);
Comments