CreateEnvelope引发异常没有讯息

问题描述

我正在尝试使用docusign C#API在演示环境上创建并发送信封。我正在使用JWT作为OAuth2流。我能够正确获取授权我的嵌入式签名所需的访问代码

函数CreateEnvelope失败,并引发异常。异常显示功能失败外没有其他信息。 Image of Exception

以前有人遇到过类似情况吗?我提供了下面的代码片段。我可能如何创建信封有明显的错误

    public static void DocusignFormatter()
    {
        EnvelopeDeFinition envDef = new EnvelopeDeFinition();
        Document doc = new Document();
        doc.DocumentBase64 = System.Convert.ToBase64String(pdfFileInfo.fileBytes);
        doc.Name = pdfFileInfo.DocName;
        doc.DocumentId = "1";
        
        envDef.Documents = new List<Document>();
        envDef.Documents.Add(doc);
        envDef.Recipients = new Recipients();
        envDef.Recipients.Signers = new List<Signer>();

        for (int i = 0; i < signatureFields.Count; i++)
        {
            Signer signer = new Signer();
            signer.Email = docRegistrant.Email;
            signer.Name = docApplicants[i].FirstName + " " + docApplicants[i].LastName;
            signer.RecipientId = $"{i+1}";
            signer.Tabs = new Tabs();
            signer.Tabs.SignHereTabs = new List<SignHere>();
            List<MyPdfSignatureField> fields;
            signatureFields.TryGetValue(i,out fields);
            foreach (MyPdfSignatureField field in fields)
            {
                SignHere signHere = new SignHere();
                signHere.DocumentId = "1";
                signHere.PageNumber = field.PageNum.ToString();
                signHere.RecipientId = i.ToString();
                signHere.XPosition = field.XLocation.ToString();
                signHere.YPosition = field.YLocation.ToString();
                signer.Tabs.SignHereTabs.Add(signHere);
            }
            envDef.Recipients.Signers.Add(signer);
        }
        envDef.Status = "created";
        


        apiclient apiclient = new apiclient(DocusignHelpers.OAuthBasePath);

        Configuration cfi = new Configuration(apiclient);
        

        cfi.AddDefaultHeader("Authorization","Bearer " + DocusignHelpers.Accesstoken);
        cfi.Accesstoken = DocusignHelpers.Accesstoken;
        cfi.Password = DocusignHelpers.Password;


        EnvelopesApi envelopesApi = new EnvelopesApi(cfi);

        EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(DocusignHelpers.AccountId,envDef);

Caught Exception values

解决方法

您缺少此行:

envDef.EmailSubject = "Test,please sign.";

但这不是例外的原因,因为您将其创建为“创建”(草稿)模式,但是一旦尝试发送它便会成为问题。

您可能希望确认所有收件人的值,并确保您没有在电子邮件字段等中发送非电子邮件(例如)之类的消息。

,

我解决了这个朋友。

我的api网址不正确。

我的主要困惑是,auth终结点与RESTful API的其余部分相比具有单独的基本URL。

该演示的授权URL为:https://account-d.docusign.com

API客户端对象实际上具有静态字段,其中包含不同平台的演示,生产,登台的url。

我最终使用了

ApiClient.Demo_REST_BasePath = "https://demo.docusign.net/restapi"

谢谢大家的答复和帮助