Attaching a file to an Invoice via the API using C#

Attaching a file to an Invoice via the API using C#

Hi,

I'm currently writing some code for a site that needs to integrate with Zoho. I've managed to write code that calls the API for creating an invoice, getting lists of products, customers etc and they all work fine.

I'm now writing a function to attach a file to an existing invoice and have found the following method:


Constructing the url is no problem and I have a byte[]  with the contents of the file and I should be able to stream that into the request body (I'm using the .Net WebRequest object). My questions are:

  1. How would I set the filename for that so when the user receives the invoice the attached file is called what I want it to be called?
  2. Is there any C# sample code for doing this? Not just the file naming part but a sample that does it all: name the file, attach the file data and posting it.

TIA

PS I didn't want to choose Uncategorised for sub forum but there wasn't a Developer API sub forum listed like you've got under Zoho CRM. If there's a more suitable forum/sub forum please feel free to move this.