【发布时间】:2020-07-29 12:47:21
【问题描述】:
问题:我正在创建一个信封定义,为其分配一个包含 4 个文档的 templateID。根据用例,我可能只想发送其中 2 个文档。在这种情况下,我的代码将我想要的 2 个文档添加到模板中的信封定义中。然后用数据填充文档标签。在将其状态设置为“已发送”之前,我检查了信封定义中的文档,并且只有 2 个文档。当我发送后去Docusign签署文件时,所有4份文件都在那里,而不仅仅是我想要的2份。有没有办法解决?我真的不想为文档的所有排列创建单独的模板,并在所有模板文档中重新创建标签。如果有更简单的创建模板和文档标签的方法,也许可以将文档复制到不同的模板中,请告诉我。
代码示例:
DSBase test = new DSBase(ApiClient);
test.CheckToken();
TemplatesApi temp = new TemplatesApi(ApiClient.Configuration);
EnvelopeTemplateResults tempResults = temp.ListTemplates(AccountID);
EnvelopeTemplate ETemplate = new EnvelopeTemplate();
EnvelopeDefinition edef = new EnvelopeDefinition();
edef.Documents = new List<Document>();
//This gets the template I am interested in. Currently there is only
//one template I am working with, it contains 4 documents.
ETemplate = temp.Get(DSConfig.TargetAccountID, tempResults.EnvelopeTemplates.FirstOrDefault().TemplateId);
edef.TemplateId = ETemplate.TemplateId;
foreach (DataRow docRow in documentRows)
{
Document doc = ETemplate.Documents.Find(X => X.Name == docRow["DOCUMENTNAME"].ToString());
//There is code here to populate the tabs on the document
//Then the document is added to the envelope definition
edef.Documents.Add(doc);
//For this particular contract only 2 documents are added to the Envelope
//However when the signer receives the Docusign notification,
//all 4 documents from the template are present to be signed.
edef.Status = "created";
int docCount = edef.Documents.Count; //Count only shows 2 documents
edef.Status = "sent";
EnvelopeSummary results = eApi.CreateEnvelope(DSConfig.TargetAccountID, edef);
}
【问题讨论】:
-
你能提供任何代码示例吗?
-
添加了代码示例。
标签: c# api templates docusignapi document