代码之家  ›  专栏  ›  技术社区  ›  Awerber

使用C重新发送Docusign信封#

  •  2
  • Awerber  · 技术社区  · 7 年前

    我正在尝试使用我在这里找到的代码重新发送信封,但运气不好。我的代码分为两部分。以下是我的ASPX页面上调用方法重新发送信封的代码:

        protected void btnResend_Click(object sender, EventArgs e)
        {
            Signer signer = new Signer();
            signer.Email = txtRecipeintEmail.Text;
            signer.Name = txtRecipientName.Text;
    
            Manager mgr = new Manager();
            mgr.ResendEnvelope(txtEnvelopeID.Text, signer);
        }
    

    下面是Manager类中的代码:

        public void ResendEnvelope (string envelopeID, Signer signer)
        {
            // instantiation of recipients as per https://stackoverflow.com/questions/21565765/resend-docusign-emails
            Recipients recipients = new Recipients
            {
                Signers = new List<Signer>()
                {
                        new Signer
                        {
                            RecipientId = "1",
                            RoleName = "Prospect",
                            Email = signer.Email,
                            Name = signer.Name,
                        },
                    }
            };
    
            string accountID = GetAccountID();
            EnvelopesApi api = new EnvelopesApi();
            EnvelopesApi.UpdateRecipientsOptions options = new EnvelopesApi.UpdateRecipientsOptions();
            options.resendEnvelope = "true";
            RecipientsUpdateSummary summary = api.UpdateRecipients(accountID, envelopeID, recipients, options);
    
            var responses = summary.RecipientUpdateResults.ToList<RecipientUpdateResponse>();
            var errors = responses.Select(rs => rs.ErrorDetails).ToList();
        }
    

    我的 GetAccountID 该函数工作正常-我使用它发送信封。中的值 txtEnvelopeID.Text 根据用于发送初始电子邮件的代码设置。我收到了最初的电子邮件。

    以下是我在错误中看到的:

    ?错误[0]。消息 “指定的信封更正有重复的收件人。” ?错误[0]。错误代码 “CORRECTION\u HAS\u DUPLICATE\u RECIPIENTS”

    当我试图设置 UpdateRecipients null ,我得到了另一个错误。当我将收件人留空时( api.UpdateRecipients(accountID, envelopeID, options: = options) ),我出错了。

    所以,我没有新的想法可以尝试。有人能帮忙吗?

    1 回复  |  直到 7 年前
        1
  •  2
  •   Frederic    7 年前

    您遇到的问题是,您正在再次创建一个已经存在的签名者,只是您没有分配相同的RecipientId,因此出现了重复错误。

    而不是

    RecipientId = "1"
    

    您需要确保分配了原始签名者ID,请参见以下内容:

    Signers = new List<Signer>()
    {
        new Signer
        {
            RecipientId = signer.RecipientId
        },
    }
    

    要将DocuSign电子邮件重新发送给收件人,您可以使用 UpdateRecipient() 方法本身(请参见下面的C示例)。这将再次触发将签名电子邮件发送给您在中指定的交易收件人 recipients 参数:

    RecipientsUpdateSummary recipientsUpdateSummary = 
                    envelopeApi.UpdateRecipients(
                        accountId, 
                        EnvelopeId, 
                        RecipientsToNotifyAgain, 
                        new EnvelopesApi.UpdateRecipientsOptions { resendEnvelope = "true" });
    

    下面是 official documentation 国家:

    enter image description here