【问题标题】:Docusign API C# How do I remove template documents from an envelope?Docusign API C# 如何从信封中删除模板文档?
【发布时间】: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


【解决方案1】:

首先,您只能在发送信封之前移除它们。因此,您需要像以前一样保持“已创建”,并在执行以下操作后执行 PUT 以更新为“已发送”:

eApi.DeleteDocuments(DSConfig.TargetAccountID, edef.EnvelopeId, new EnvelopeDefinition{ Documents = new List<Document>);

您提供要删除的文档列表的位置。

(注意这里的 EnvelopeDefinition 应该只包含您要删除的文档,而不是其他任何内容)。

【讨论】:

  • 问题是我没有看到信封中的文件,但它们出现在发送给签名者的文档包中。有没有办法将文档从一个模板复制到另一个模板?然后我可以创建一个工作模板,只放入我想要发送的文件,将工作模板与信封相关联,此时应该只有我想要的文件。这样的事情可能吗?
  • 不确定“我看不到”是什么意思。他们在那里。你应该试试我建议的代码 sn-p。您可能需要解释您正在尝试做什么。一种选择是为每个场景使用许多不同的模板......
  • 我的意思是信封定义,在其文档属性中,只有我从包含 4 个文档的模板中添加的 2 个文档,如您在上面的代码中所见。然而,即使看起来信封中只有 2 个文件,一旦将其发送给签名者,签名者就会收到 4 个文件。我看不到信封中的文件,因此无法删除或移除它们。
  • 您使用的模板有 4 个文档,因此即使在您的信封定义中您只有 2 个,4 个也会在那里。模板包括文档、收件人和选项卡(以及其他元数据),由于您选择使用此模板,因此将包括在内。您可以删除它们或使用 2 个不同的模板。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多