Unable to load WORD document using DocuSign REST API

I am trying to use the rest of the APIs to load a WORD document (* .doc) to match with the code below. But the exception is thrown - UNABLE_TO_LOAD_DOCUMENT, the document is damaged. If I use the same document to download directly from the docusign website using my Dev account, it loads correctly, without errors. Can someone help me find out what is wrong with the code below. ( The code below works fine for a .PDF file )

byte[] fileBytes = File.ReadAllBytes(pathOfTheWordDocFile);
EnvelopeDefinition envDef = new EnvelopeDefinition();
envDef.EmailSubject = "[DocuSign C# SDK] - Please sign this doc";

// Add a document to the envelope
Document doc = new Document();
doc.DocumentBase64 = System.Convert.ToBase64String(fileBytes);
doc.Name = Path.GetFileName(strPath);
doc.DocumentId = "1";

envDef.Documents = new List<DocuSignModel.Document>();
envDef.Documents.Add(doc);
+4
source share
1 answer

content-type application/pdf. mime, ,

doc.FileExtension = "docx";

, , :

byte[] fileBytes = File.ReadAllBytes(pathOfTheWordDocFile);
EnvelopeDefinition envDef = new EnvelopeDefinition();
envDef.EmailSubject = "[DocuSign C# SDK] - Please sign this doc";

// Add a document to the envelope
Document doc = new Document();
doc.DocumentBase64 = System.Convert.ToBase64String(fileBytes);
doc.Name = Path.GetFileName(strPath);
doc.DocumentId = "1";
doc.FileExtension = "docx";

envDef.Documents = new List<DocuSignModel.Document>();
envDef.Documents.Add(doc);
+6

All Articles