【发布时间】:2020-04-01 22:00:36
【问题描述】:
我正在使用 C# DocuSign 库,并且我在信封中发送 2 个文档。
我正在添加 2 个收件人。
第一个收件人必须签署文档 1,因此 SignHere 类将 DocumentId 设置为 1。 第二个收件人必须签署文档 2,因此 SignHere 类的 DocumentId 设置为 2。
会发生什么情况是,两个收件人都被要求签署文档 1 和文档 2,并且签名相互覆盖。
因此 SignHere 类中的 DocumentId 将被忽略。这似乎是一个错误。
似乎锚字符串是唯一真正控制谁签署什么文档的东西,并且两个文档都将具有相同的锚字符串。这是因为文档将预先构建有锚字符串,如<<<signhere:1>>>
我已经编辑了这个以显示我的代码:
public string SendDocument(
DocuSignDocument[] Documents,
DocuSignRecipient[] Recipients,
DocuSignSignature[] Signatures,
string EmailSubject = null)
{
string AccessToken = GetAccessToken();
List<Document> EnvelopeDocuments = new List<Document>();
int Index = 0;
foreach (DocuSignDocument Doc in Documents)
{
Document Document = new Document
{
DocumentBase64 = Convert.ToBase64String(FileToBytes(Doc.FileName)),
Name = Doc.DocumentName,
FileExtension = Path.GetExtension(Doc.FileName).TrimStart('.'),
DocumentId = (Index + 1).ToString()
};
EnvelopeDocuments.Add(Document);
Index++;
}
List<Signer> Signers = new List<Signer>();
List<SignHere> SignTabs;
Index = 0;
foreach (DocuSignRecipient Recipient in Recipients)
{
Signer Signer = new Signer()
{
Email = Recipient.EmailAddress,
Name = Recipient.Name,
RecipientId = (Index + 1).ToString(),
RoutingOrder = (Index + 1).ToString()
//RoutingOrder = "1"
};
SignTabs = new List<SignHere>();
// Set the signatures needed for this recipient
foreach (DocuSignSignature Sig in Signatures)
{
if (Sig.DocumentIndex < 0 || Sig.DocumentIndex > Documents.Length - 1)
throw new Exception("Invalid signature DocumentIndex");
if (Sig.RecipientIndex < 0 || Sig.RecipientIndex > Recipients.Length - 1)
throw new Exception("Invalid signature RecipientIndex");
if (Sig.RecipientIndex == Index)
{
// Signature is for this recipient
SignHere SignHere = new SignHere()
{
// It seems DocumentId here is ignored because this recipient still gets asked to sign both documents
DocumentId = (Sig.DocumentIndex + 1).ToString(),
RecipientId = (Sig.RecipientIndex + 1).ToString(),
TabLabel = "Sign here for " + Recipient.Name,
AnchorString = "<<<signhere:" + (Sig.DocumentSignatureIndex + 1) + ">>>"
};
SignTabs.Add(SignHere);
}
}
Signer.Tabs = new Tabs() { SignHereTabs = SignTabs };
Signers.Add(Signer);
Index++;
}
if (EmailSubject == null)
EmailSubject = "Please sign the document";
EnvelopeDefinition Envelope = new EnvelopeDefinition
{
EmailSubject = EmailSubject,
Documents = EnvelopeDocuments,
Recipients = new Recipients { Signers = Signers },
Status = "sent"
};
ApiClient Client = new ApiClient(ApiAddress);
Client.Configuration.AddDefaultHeader("Authorization", "Bearer " + AccessToken);
EnvelopesApi EnvelopesApi = new EnvelopesApi(Client.Configuration);
EnvelopeSummary Results = EnvelopesApi.CreateEnvelope(_AccountId, Envelope);
return Results.EnvelopeId;
【问题讨论】:
-
如果您分享您的代码 - 这会有所帮助。收件人是嵌入式的还是远程的?
-
您分配选项卡的方式是基于收件人,而不是基于文档。你仍然可以做你想做的事,但首先必须确保你有正确的 RecipientId
-
我已经编辑了上面的原始帖子以显示一些代码
-
好的,现在我知道它是关于anchorString的,所以我在下面发布了一个答案
标签: docusignapi