protected void CreateAndSend() { DocuSignAPI.EnvelopeStatus status = null; buttonTable.Visible = false; // Construct the envelope basics DocuSignAPI.Envelope envelope = new DocuSignAPI.Envelope(); envelope.Subject = "DocuSign API SDK Example"; envelope.EmailBlurb = "This envelope demonstrates embedded signing"; envelope.AccountId = Session["APIAccountId"].ToString(); // Create the recipient(s) envelope.Recipients = ConstructRecipients(); // Add the document to the envelope DocuSignAPI.Document stockDocument = new DocuSignAPI.Document(); stockDocument.PDFBytes = Resources.DocuSign_Demo__111_PDF; stockDocument.Name = "Demo Document"; stockDocument.ID = "1"; stockDocument.FileExtension = "pdf"; envelope.Documents = new DocuSignAPI.Document[] { stockDocument }; // Add the tabs to the envelope envelope.Tabs = AddTabs(envelope.Recipients.Length); DocuSignAPI.APIServiceSoapClient client = CreateAPIProxy(); try { // Send the envelope and temporarily store the status in the session status = client.CreateAndSendEnvelope(envelope); if (status.SentSpecified) { Session["EnvelopeStatus"] = status; base.AddEnvelopeID(status.EnvelopeID); // Start the first signer SignFirst(status); } } catch (Exception ex) { base.GoToErrorPage(ex.Message); } }
protected void SendNow(DocuSignAPI.Envelope envelope) { DocuSignAPI.APIServiceSoapClient client = CreateAPIProxy(); try { // Create and send the envelope in one step DocuSignAPI.EnvelopeStatus status = client.CreateAndSendEnvelope(envelope); // If we succeeded, go to the status if (status.SentSpecified) { base.AddEnvelopeID(status.EnvelopeID); Response.Redirect("GetStatusAndDocs.aspx", false); } } catch (Exception ex) { base.GoToErrorPage(ex.Message); } }