Skip to content

Instantly share code, notes, and snippets.

@Ergin008
Created February 12, 2018 21:54
Show Gist options
  • Save Ergin008/49f1c8eec6ba7e8f604eb439e9dc2993 to your computer and use it in GitHub Desktop.
Save Ergin008/49f1c8eec6ba7e8f604eb439e9dc2993 to your computer and use it in GitHub Desktop.
SOAP Create Envelope (C#)
// Create the recipient
DocuSignWeb.Recipient recipient = new DocuSignWeb.Recipient();
recipient.Email = "Test email";
recipient.UserName = "Testing account";
recipient.Type = DocuSignWeb.RecipientTypeCode.Signer;
recipient.ID = "1";
recipient.RoutingOrder = 1;
// Need to specify captive info to embed the recipient
recipient.CaptiveInfo = new DocuSignWeb.RecipientCaptiveInfo();
recipient.CaptiveInfo.ClientUserID = "User4521";
// Create the envelope content
DocuSignWeb.Envelope envelope = new DocuSignWeb.Envelope();
envelope.Subject = "Subject";
envelope.EmailBlurb = "Email content";
envelope.Recipients = new DocuSignWeb.Recipient[] { recipient };
envelope.AccountId = accountId;
// Attach the document(s)
envelope.Documents = new DocuSignWeb.Document[1];
DocuSignWeb.Document doc = new DocuSignWeb.Document();
doc.ID = "1";
doc.Name = "Document Name";
doc.PDFBytes = [Location of Document];
envelope.Documents[0] = doc;
// Create a new signature tab
DocuSignWeb.Tab tab = new DocuSignWeb.Tab();
tab.DocumentID = "1";
tab.RecipientID = "1";
tab.Type = DocuSignWeb.TabTypeCode.SignHere;
tab.PageNumber = "1";
tab.XPosition = "100";
tab.YPosition = "150";
envelope.Tabs = new DocuSignWeb.Tab[1];
envelope.Tabs[0] = tab;
// Create the envelope on the account -- it will be a draft
DocuSignWeb.EnvelopeStatus status = _apiClient.CreateAndSendEnvelope(envelope);
// Examine the return status
Console.WriteLine("Envelope status is {0}", status.Status);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment