调用CreateEnvelope时出错:收件人无效的用户名

时间:2019-06-13 18:56:43

标签: c# asp.net docusignapi

我在我的.NET应用程序中使用了更新的DocuSign API,并且为了进行身份验证,我使用了以“ signature%20extended”作为代码的身份验证代码授予工作流程。我可以成功进行身份验证,并为要进行身份验证的用户找回访问令牌。

然后我会毫无问题地获取帐户详细信息

ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi");
var docuSignUserInfo = apiClient.GetUserInfo(accessToken).Accounts.FirstOrDefault();

然后我继续创建我的签名者和文档模型

Document document = new Document
            { DocumentBase64 = Convert.ToBase64String(ReadContent(docName)),
              Name = "Lorem Ipsum", FileExtension = "pdf", DocumentId = "1"
            };
Document[] documents = new Document[] { document };

// Create the signer recipient object 
            Signer signer = new Signer
            { Email = "test@example.com", FirstName = "Jane", LastName="Doe" ClientUserId = "1000",
              RecipientId = "1", RoutingOrder = "1"
            };
Signer[] signers = new Signer[] { signer };
Recipients recipients = new Recipients { Signers = new List<Signer>(signers) };

EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition
            { EmailSubject = "Please sign the document",
              Documents = new List<Document>( documents ),
              Recipients = recipients,
              Status = "sent"
            };

ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi");
apiClient.Configuration.AddDefaultHeader("Authorization", "Bearer " + accessToken);
EnvelopesApi envelopesApi = new EnvelopesApi(apiClient.Configuration);

//This is the API call that throws the error below
EnvelopeSummary results = envelopesApi.CreateEnvelope(accountId, envelopeDefinition);


Error calling CreateEnvelope: {
  "errorCode": "INVALID_USERNAME_FOR_RECIPIENT",
  "message": "The user name for the recipient is invalid. Envelope definition is missing a UserName for recipientId: 1"
}

根据我的理解,我不需要使用“访问令牌”进行身份验证时指定任何用户名/密码。另外,我不明白为什么收件人需要一个用户名?

1 个答案:

答案 0 :(得分:1)

我认为您需要为Name模型提供Signer属性。请尝试。

我同意FirstNameLastName听起来很需要,但是这些属性可能尚未完全实现(或错误)。

请告知这是否解决了您的问题。谢谢。

已添加

FirstNameLastName属性是可选的。已提交DocuSign内部错误报告DEVDOCS-1079,以改进这些字段的文档。