Last active
January 7, 2016 23:08
-
-
Save Ergin008/005279f8449139601dac to your computer and use it in GitHub Desktop.
code snippet that shows how to create and send an envelope using the DocuSign .NET client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Read a file from disk to use as a document | |
byte[] fileBytes = File.ReadAllBytes("[PATH/TO/DOCUMENT/TEST.PDF]"); | |
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 = "TestFile.pdf"; | |
doc.DocumentId = "1"; | |
envDef.Documents = new List<Document>(); | |
envDef.Documents.Add(doc); | |
// Add a recipient to sign the documeent | |
Signer signer = new Signer(); | |
signer.Name = "[SIGNER_NAME]"; | |
signer.Email = "[SIGNER_EMAIL]"; | |
signer.RecipientId = "1"; | |
// Create a |SignHere| tab somewhere on the document for the recipient to sign | |
signer.Tabs = new Tabs(); | |
signer.Tabs.SignHereTabs = new List<SignHere>(); | |
SignHere signHere = new SignHere(); | |
signHere.DocumentId = "1"; | |
signHere.PageNumber = "1"; | |
signHere.RecipientId = "1"; | |
signHere.XPosition = "100"; | |
signHere.YPosition = "150"; | |
signer.Tabs.SignHereTabs.Add(signHere); | |
envDef.Recipients = new Recipients(); | |
envDef.Recipients.Signers = new List<Signer>(); | |
envDef.Recipients.Signers.Add(signer); | |
// set envelope status to "sent" to immediately send the signature request | |
envDef.Status = "sent"; | |
// Use the EnvelopesApi to send the signature request! | |
EnvelopesApi envelopesApi = new EnvelopesApi(); | |
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountId, envDef); | |
// print the JSON response | |
Console.WriteLine("EnvelopeSummary:\n{0}", JsonConvert.SerializeObject(envelopeSummary)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment