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.


    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now