0 Replies Latest reply on Jan 11, 2016 10:13 PM by vinod.c062

    Getting "Object Reference not set to instance of and object" error while calling senddocument through API

    vinod.c062 Level 1

              public void sendDocument(string apiKey, string fileName, string formFieldLayerTemplateKey, string recipient, string recipientSet)

              {

       

                  com.echosign.secure.FileInfo[] fileInfos = new com.echosign.secure.FileInfo[1];

                  fileInfos[0] = new com.echosign.secure.FileInfo();

                  fileInfos[0].fileName = fileName;

                 

                  Byte[] bytes = File.ReadAllBytes(".\\" + fileName);

                  String filed = Convert.ToBase64String(bytes);

                  byte[] filedata = Convert.FromBase64String(filed);

       

       

                  fileInfos[0].file = filedata;

       

       

                  SenderInfo senderInfo = new SenderInfo();

                  senderInfo = null;

                  RecipientInfo[] recipientInfo = new RecipientInfo[2];

       

       

                  RecipientInfo recipientEmail = new RecipientInfo();

                  recipientEmail.email = recipient;

                  recipientEmail.fax = null;

                  recipientEmail.role = RecipientRole.SIGNER;

                  recipientEmail.roleSpecified = true;

                  recipientInfo[0] = recipientEmail;

       

                  DocumentCreationInfo documentInfo = new DocumentCreationInfo();

                  documentInfo.recipients = recipientInfo;

                  documentInfo.name = "Testing Echo";

                  documentInfo.fileInfos = fileInfos;

                  documentInfo.signatureType = SignatureType.ESIGN;

                  documentInfo.signatureFlow = SignatureFlow.SENDER_SIGNATURE_NOT_REQUIRED;

       

                      ES.sendDocument(apiKey, senderInfo, documentInfo);

              }