我能够让用户在应用程序本身内签署文档。 但是代码也在发送电子邮件的同时在应用程序iframe中显示文档。
如果文档显示在同一窗口中,我不想向用户发送电子邮件。 此外,一旦文档签名,就可以选择下载或将签名文档作为附件发送给用户。
我有以下代码,它会向用户发送电子邮件并在同一窗口中显示docusign界面,供用户签署文件:
public void ShowDocumentInConsole(string name, string email)
{
var docuSignClient = new DocuSignClient(this.DocuSignCredentials);
var accountId = docuSignClient.AccountId;
//===========================================================
// Step 2: Create and Send an Envelope with Embedded Recipient
//===========================================================
// Read a file from disk to use as a document.
byte[] fileBytes = System.IO.File.ReadAllBytes(@"D:\XXX\XXX\XXX\XXX\DocuSignTemplateNew.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.Email = email;
signer.Name = name;
signer.RecipientId = "1";
signer.ClientUserId = "1234"; // must set |clientUserId| to embed the recipient!
// 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.AnchorString = "Signature";
signHere.AnchorXOffset = "1";
signHere.AnchorYOffset = "0";
signHere.AnchorIgnoreIfNotPresent = "false";
signHere.AnchorUnits = "inches";
signHere.DocumentId = "1";
signHere.PageNumber = "1";
signHere.RecipientId = "1";
//signHere.XPosition = "100";
//signHere.YPosition = "100";
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";
// |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests)
EnvelopesApi envelopesApi = new EnvelopesApi();
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountId, envDef);
//===========================================================
// Step 3: Create Embedded Signing View (URL)
//===========================================================
RecipientViewRequest viewOptions = new RecipientViewRequest()
{
ReturnUrl = "http://localhost:50305/",
ClientUserId = "1234", // must match clientUserId set in step #2!
AuthenticationMethod = "email",
UserName = envDef.Recipients.Signers[0].Name,
Email = envDef.Recipients.Signers[0].Email
};
// create the recipient view (aka signing URL)
ViewUrl recipientView = envelopesApi.CreateRecipientView(accountId, envelopeSummary.EnvelopeId, viewOptions);
// print the JSON response
var view = JsonConvert.SerializeObject(recipientView);
// Start the embedded signing session
System.Diagnostics.Process.Start(recipientView.Url);
}
答案 0 :(得分:0)
您可以在帐户设置中控制发送给嵌入收件人的电子邮件。
请参阅此answer
是的,您可以使用getEnvelopeDocument api手动下载文档。有关c#代码,请参阅此answer。
此外,DocuSign可以自动附加电子邮件中的文件。它可以在account settings中配置。
请参阅文档传送部分
将文档附加到完成电子邮件。选中后,所有已完成的文档都包含在作为PDF文件附件发送给发件人和签名者的已完成电子邮件中。要将完成证书和文件包括在内,您还必须选择将完成证书附加到已完成文件的设置。
将完成证书附加到已完成的文档选择此选项后,当信封作为组合PDF下载时,完成证书将包含在文件末尾。 (证书始终包含在单独的PDF下载选项中。)如果还选择了“将文档附加到完成电子邮件”设置,则证书将作为单独附件包含在发送给发件人和签名者的已完成电子邮件中。