public void CreateEnvelopeFromTemplatesAndFormsTest() { // Configure the envelope information DocuSignWeb.EnvelopeInformation envelopeInfo = new DocuSignWeb.EnvelopeInformation(); envelopeInfo.AccountId = _accountId; envelopeInfo.EmailBlurb = "testing docusign creation services"; envelopeInfo.Subject = "create envelope from templates and forms test"; DocuSignWeb.CompositeTemplate template = new DocuSignWeb.CompositeTemplate(); DocuSignWeb.Recipient recipient1 = new DocuSignWeb.Recipient(); recipient1.UserName = "******"; // TODO: replace the email string with an actual email recipient1.Email = "test email one"; recipient1.Type = DocuSignWeb.RecipientTypeCode.Signer; recipient1.RequireIDLookup = false; recipient1.RequireIDLookupSpecified = true; recipient1.RoutingOrder = 1; recipient1.RoutingOrderSpecified = true; recipient1.RoleName = "One"; recipient1.ID = "1"; DocuSignWeb.Recipient recipient2 = new DocuSignWeb.Recipient(); recipient2.UserName = "******"; // TODO: replace the email string with an actual email recipient2.Email = "test email two"; recipient2.Type = DocuSignWeb.RecipientTypeCode.Signer; recipient2.RequireIDLookup = false; recipient2.RequireIDLookupSpecified = true; recipient2.RoutingOrder = 2; recipient2.RoutingOrderSpecified = true; recipient2.RoleName = "Two"; recipient2.ID = "2"; DocuSignWeb.Recipient[] signers = { recipient1, recipient2 }; // Configure the inline templates DocuSignWeb.InlineTemplate inlineTemplate = new DocuSignWeb.InlineTemplate(); inlineTemplate.Sequence = "1"; inlineTemplate.Envelope = new DocuSignWeb.Envelope(); inlineTemplate.Envelope.Recipients = signers; inlineTemplate.Envelope.AccountId = _accountId; // This tab matches the DateSigned tab assigned to recipient one DocuSignWeb.Tab tab1 = new DocuSignWeb.Tab(); tab1.RecipientID = "1"; tab1.TabLabel = "DocuSignDateSignedOne"; tab1.Type = DocuSignWeb.TabTypeCode.DateSigned; // This tab matches the SignHere tabs assigned to recipient two DocuSignWeb.Tab tab2 = new DocuSignWeb.Tab(); tab2.RecipientID = "2"; tab2.TabLabel = "SignTwo\\*"; tab2.Type = DocuSignWeb.TabTypeCode.SignHere; // This tab matches the SignHere tabs assigned to recipient one DocuSignWeb.Tab tab3 = new DocuSignWeb.Tab(); tab3.RecipientID = "1"; tab3.TabLabel = "SignOne\\*"; tab3.Type = DocuSignWeb.TabTypeCode.SignHere; // This tab matches the DateSigned tab assigned to recipient two DocuSignWeb.Tab tab4 = new DocuSignWeb.Tab(); tab4.RecipientID = "2"; tab4.TabLabel = "DocuSignDateSignedTwo"; tab4.Type = DocuSignWeb.TabTypeCode.DateSigned; // This tab matches nothing -- but that's okay! // It will just get discarded DocuSignWeb.Tab tab5 = new DocuSignWeb.Tab(); tab5.RecipientID = "1"; tab5.TabLabel = "asdf"; tab5.Type = DocuSignWeb.TabTypeCode.FullName; inlineTemplate.Envelope.Tabs = new DocuSignWeb.Tab[] { tab1, tab2, tab3, tab4, tab5 }; template.InlineTemplates = new DocuSignWeb.InlineTemplate[] { inlineTemplate }; // Configure the document template.Document = new DocuSignWeb.Document(); template.Document.ID = "1"; template.Document.Name = "Form Document"; template.Document.PDFBytes = Resource.LoremIpsum; template.Document.TransformPdfFields = true; template.Document.FileExtension = "pdf"; // Create draft with all the composite template information DocuSignWeb.EnvelopeStatus status = _apiClient.CreateEnvelopeFromTemplatesAndForms(envelopeInfo, new DocuSignWeb.CompositeTemplate[] { template/*, template2*/ }, false); // Confirm that the envelope has been assigned an ID Assert.IsNotNullOrEmpty(status.EnvelopeID); // Confirm that we have the correct number of tabs for each recipient Assert.AreEqual(3, status.RecipientStatuses[0].TabStatuses.Length); Assert.AreEqual(3, status.RecipientStatuses[1].TabStatuses.Length); Console.WriteLine("Envelope Id is {0}", status.EnvelopeID); }
public void CreateEnvelopeFromTemplatesAndFormsTest() { // Configure the envelope information DocuSignWeb.EnvelopeInformation envelopeInfo = new DocuSignWeb.EnvelopeInformation(); envelopeInfo.AccountId = _accountId; envelopeInfo.EmailBlurb = "testing docusign creation services"; envelopeInfo.Subject = "create envelope from templates and forms test"; DocuSignWeb.CompositeTemplate template = new DocuSignWeb.CompositeTemplate(); // Configure the server templates // Should you want to use a server template, you can specify it here /*DocuSignWeb.ServerTemplate serverTemplate = new DocuSignWeb.ServerTemplate(); serverTemplate.TemplateID = "server template id"; serverTemplate.Sequence = "4"; template.ServerTemplates = new DocuSignWeb.ServerTemplate[] { serverTemplate };*/ // Configure the inline templates DocuSignWeb.InlineTemplate inlineTemplate = new DocuSignWeb.InlineTemplate(); inlineTemplate.Sequence = "2"; inlineTemplate.Envelope = new DocuSignWeb.Envelope(); inlineTemplate.Envelope.Recipients = HeartbeatTests.CreateOneSigner(); inlineTemplate.Envelope.AccountId = _accountId; template.InlineTemplates = new DocuSignWeb.InlineTemplate[] { inlineTemplate }; // Configure the pdf metadata template // In this case, we want to extract fields from the pdf itself DocuSignWeb.PDFMetaDataTemplate pdfMetaDataTemplate = new DocuSignWeb.PDFMetaDataTemplate(); pdfMetaDataTemplate.Sequence = "3"; template.PDFMetaDataTemplate = pdfMetaDataTemplate; // Configure the document template.Document = new DocuSignWeb.Document(); template.Document.ID = "1"; template.Document.Name = "Form Document"; template.Document.PDFBytes = Resource.twoPagePdfWithMeta; template.Document.TransformPdfFields = true; template.Document.FileExtension = "pdf"; // Create draft with all the composite template information DocuSignWeb.EnvelopeStatus status = _apiClient.CreateEnvelopeFromTemplatesAndForms(envelopeInfo, new DocuSignWeb.CompositeTemplate[] { template }, false); // Confirm that the envelope has been assigned an ID Assert.IsNotNullOrEmpty(status.EnvelopeID); Console.WriteLine("Envelope Id is {0}", status.EnvelopeID); }